On Submit not working in order guides

kannann_
Kilo Expert

Hi All,

I have an order guide which has 4 catalog items associated with it. I have few On Submit catalog client scripts on these catalog items. They don't seem to work when I click checkout.

Please help.

Thanks,

Kannan

1 ACCEPTED SOLUTION

kannann_
Kilo Expert

Hey All,



I got the issue, the system property glide.sc.guide.tab.validate was set to false. I changed it to True and it is working fine now.


View solution in original post

17 REPLIES 17

Hi Kannan,



I have written only one onsubmit client script in the 'Joiner' catalog Item. I have written onSubmit client script to valid start and end date.



function onSubmit() {


  //Type appropriate comment here, and begin script below


  if(g_form.getValue('v_type_of_employee') == 'contractor'){


  var jsStartDate = new Date(g_form.getValue('v_start_date'));


  var jsEndDate     = new Date(g_form.getValue('v_end_date'));



  if (jsEndDate < jsStartDate) {


  alert(getMessage('End date must be after Start date'));


  g_form.showErrorBox('v_end_date',"End date must be after Start date");


  return false;


  }


  return true;


  }


}


Hi Anubav,



I don't see an issue with your code, the start and end date will be checked whenever Type of employee = Contractor..


Nathan Underwoo
Tera Expert

I'm having the same problem. My onSubmit script is on the Order Guide itself, not a specific item. I want the script to run when the Choose Options button is clicked. I have checked the system property and it is already set to true.



I may go ahead and use two onChange scripts to do this instead but I'd prefer to do onSubmit just because then it will only need to run once.



**EDIT 1**           Found a KB article that might apply here. I'm on Helsinki so it should be fixed since Geneva, but I'm going to try changing this property anyway. The article is here.



**EDIT 2**           Nevermind. We don't want to use cart layouts for our organization, so this really needs to work without changing that property.


Can you post the onSubmit script?


Here's the script:


function onSubmit() {


    //First, set alpha servers to 1 if alpha is checked and new server


  if (g_form.getBooleanValue('alpha') && g_form.getValue('server_purpose') == 'new_pod_structure'){


  g_form.setValue('alpha_app_server_count', 1, '1');


  //Also set alpha db server count if db servers requested in dev/prod


  if (g_form.getIntValue('beta_db_server_count') > 0 || g_form.getIntValue('prod_db_server_count') > 0){


  g_form.setValue('alpha_db_server_count', 1, '1');


  }


  }



  //Now update server count totals to reflect combined total of beta/prod environments


  var app_count = g_form.getIntValue('beta_app_server_count') + g_form.getIntValue('prod_app_server_count');


  var db_count = g_form.getIntValue('beta_db_server_count') + g_form.getIntValue('prod_db_server_count');


  g_form.setValue('app_server_count', app_count, app_count);


  g_form.setValue('db_server_count', db_count, db_count);


}