Joomla.updatebutton
is a vital javascript function within the Joomla platform. It is invoked upon submitting a form when a user clicks on either the cancel or save button. I have customized this function in the following manner:
saveFunction = Joomla.submitbutton ;
Joomla.submitbutton = function() {
timeValue = jQuery("div.controls > input#jform_length.inputbox").val();
if(timeValue.length < 8){
alert("Please enter the time in the correct format");
}
else {
saveFunction('settime.save') ;
}
}
Upon clicking the save button,
Joomla.submitbutton('settime.save')
is executed, and when the cancel button is clicked, Joomla.submitbutton('settime.cancel')
is invoked. How can I differentiate whether the user has clicked on cancel or save button? In other words, how can I access the argument passed to Joomla.submitbutton
when overriding the function.