Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

multirow variable set is accepting single group. User should not be able to submit single row

sushmachava
Tera Contributor

multirow variable set is accepting single group. User should not be able to submit single row how to achieve this

1 REPLY 1

Brad Bowman
Mega Patron

You can get the value of the entire MRVS, parse it, and stop the submit if the length of the object is less than 2 (rows)

 

function onSubmit() {
	var mrvs = g_form.getValue('mrvs_internal_name');
	if(mrvs.length > 2) { //length of the entire MRVS string - native UI returns [] for empty MRVS value which causes a parsing error
		var obj = JSON.parse(mrvs);
        If (obj.length < 2) { //MRVS contains only one row
            alert('Group table must contain more than one row.');
            return false;
        }
    } else { //MRVS does not contain any rows
        alert('Group table must contain at least two rows.');
        return false;
   }
}