Make any one of the Order Guide choices Mandatory

amacqueen
Mega Guru

We have an order guide that contains a series of variables for user information and then lists a series of accounts the user can request.

As things stand if the user doesn't choose an account and then selects the 'Choose Options' button it falls over so I need to find a way to force the user to select at least one of these accounts before they can select 'Choose Options'.

Any input gratefully received.

1 ACCEPTED SOLUTION

Your 'onSubmit' client script should be against the catalog item (the actual item/order guide), not on the Order Guide table.   Use the 'Client Scripts' related list at the bottom of your order guide form to add the necessary catalog client script.   If the related list isn't there, you'll need to personalize related lists to add it.


View solution in original post

14 REPLIES 14

Harish Murikina
Tera Guru

Write onsubmit script on order guide and check either atlease one account selected ot not



ex:


if(account1 == false && account == false)


{


alert('Please select atlease one account');


return false;


}


Thanks Harish I'll give that a try.


Harish I've tried this but get a syntax error on line 3 column 21?



function onSubmit() {



  if (item.AD Account == false && item.OPUS == false && item.PKMS == false && item.CODA == false && item.Vision == false && item.TRF == false && item.ACE == false && item.TMS == false && item.E400 == false)


  alert('Please select at least one account before continuing');


return false;



}


If the choices are checkboxes use below code






  if (g_form.getValue('AD Account varablename') == 'false' && g_form.getValue('item.OPUS varablename') == 'false' && g_form.getValue('item.PKMS varablename') == 'false' && g_form.getValue('item.CODA variablename') == 'false' && g_form.getValue('item.Vision varablename') == 'false' && g_form.getValue('item.TRF variablename') == 'false' && g_form.getValue('item.ACE varablename') == 'false' && g_form.getValue('item.TMS varaible name') == 'false' && g_form.getValue('item.E400 varablename') == 'false')


  alert('Please select at least one account before continuing');


return false;



}






If its fre form text use below code






  if (g_form.getValue('AD Account varablename') == '' && g_form.getValue('item.OPUS varablename') == '' && g_form.getValue('item.PKMS varablename') == '' && g_form.getValue('item.CODA variablename') == '' && g_form.getValue('item.Vision varablename') == '' && g_form.getValue('item.TRF variablename') == '' && g_form.getValue('item.ACE varablename') == '' && g_form.getValue('item.TMS varaible name') == '' && g_form.getValue('item.E400 varablename') == '')


  alert('Please select at least one account before continuing');


return ;



}