EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on April 07, 2015, 09:49:56 PM



Title: globally replace all occurences before onBeforeSubmit
Post by: devnull on April 07, 2015, 09:49:56 PM
How can I globally replace all occurrences of a single quote with 2 single quotes before submitting a form.

I cannot use the existing events as they are all being used for other things, I need to be able to do this to all form submissions whilst leaving the existing events intact.

What I need is a onBeforeSubmit event that can be set to globally do the replacements.

Maybe this can be done at the ajax level where the form() calls the jquery ajax function ?

Thanks

edit
===

Could $.ajaxPrefilter() somehow be used to do this ?



Title: Re: globally replace all occurences before onBeforeSubmit
Post by: stworthy on April 08, 2015, 08:15:55 AM
The 'onSubmit' event fires before submitting a form. You can add additional field but can not override an existing field.
Code:
$('#ff').form({
  onSubmit: function(param){
    param.f1 = ...
    param.f2 = ...
  }
});


Title: Re: globally replace all occurences before onBeforeSubmit
Post by: devnull on April 08, 2015, 04:01:56 PM
Hi;

I cannot use the onsubmit event as that event is already being used, and I would need to add code to every single form and there are jost too many to do that.

I am looking to do this globally, to apply to every form submission without disturbing the existing events.

Thanks