what is the Use of gsftSubmit , why should we use it, when use it?

chanikya
Kilo Sage

Hi,

Please don't copy and past WIKI information, please explain in your own words..

 

why should we use, ?? when ??? why??? what is the purpose 

i have taken this script from wiki.. what is explains here , : UI action: Reopen Incident

already we have UI action name ,so whay should we use gsftSubmit ????

function reopen(){
   if(g_form.getValue('comments') == ''){
      //Remove any existing field message, set comments mandatory, and show a new field message
      g_form.hideFieldMsg('comments');
      g_form.setMandatory('comments', true);
      g_form.showFieldMsg('comments','Comments are mandatory when reopening an Incident.','error');
      return false;  //Abort submission
   }
   //Call the UI Action and skip the 'onclick' function
   gsftSubmit(null, g_form.getFormElement(), 'reopen_incident'); //MUST call the 'Action name' set in this UI Action
}

//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if(typeof window == 'undefined')
   serverReopen();

function serverReopen(){
   //Set the 'State' to 'Active', update and reload the record
   current.state = 2;
   current.update();
   gs.addInfoMessage('Incident ' + current.number + ' reopened.');
   action.setRedirectURL(current);
}

11 REPLIES 11

Community Alums
Not applicable

It is mostly used in Ui action which uses Client side and server side Interaction.

The main use is to trigger the Ui Action specified in the third parameter of the gsftSubmit function which mainly do the server side required works.

sawyan1
Tera Contributor

In lame language:

 

  • It is especially useful in client scripts when you want to trigger a form submission once UI action work is performed and also it will require form validation like parameters of fields or mandatory fields for submission.In this case gsftSubmit can be used for submission in UI action rather than calling Submit button for form submission.

 

gsftSubmit() can be called automatically to submit the form without the need for the user to click anything.

 

If you need to understand more I can revert back with more information.