How to call custom UI Action that overrides global in gsftSubmit

Vladimir Cheres
Tera Expert

Hello,

I have an 'Update' UI action on specific table that overrides the global UI action. I made my custom button to do some client side validation so if nothing changed on the form not to update the record else to do some server-side code. Here is the code

however the gsftSubmit always call the global UI action. It seems to be always on the form at the backend. I tried to add condition to global button to exclude tablename (current.sys_class_name != ' myTable' ) but it does not work it is still taken in the submit.

function checkModified() {
if(!g_form.modified){
alert('You have not made any changes to the form!');
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'sysverb_update');
}

if (typeof window == 'undefined') {

// My server-side code

}

Is there a way to explicitly call the button by its gsft_id, but not the id which is the same as the global one ?

 

Any help please ?

Thanks!

 

7 REPLIES 7

Vladimir Cheres
Tera Expert

PS. I know this can be handled with onSubmit client script but still would like to know if can be done within UI Action as well.

Dubz
Mega Sage

Have you tried changing the action name on your UI action and calling that in the gsftSubmit instead? eg:

gsftSubmit(null, g_form.getFormElement(), 'something_else');

If I change the name of my  custom UI action that is supposed to override Global one I will end up with two button on the form (which is normal by design). I did that so  I can see both buttons on the form so in order to inspect my custom button and test if the code does what it is expected (and it did), but as soon as you revert the action_name in gsftSubmit back to original name it seems that it always pick up the global UI action. I also try to play with the 'Order' of both UI action but with no success.

JennyHu
Tera Guru
Tera Guru

Do you mean that your 'Update" UI button is not getting called, but the global "Update" UI button is?

Check and see if you have the following configured:

  1. "Client" field is checked.  This will call the client script in your code.
  2. "Onclick" field is configured to call checkModified().