EasyUI Forum
September 14, 2025, 03:33:58 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: globally replace all occurences before onBeforeSubmit  (Read 7414 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« 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 ?

« Last Edit: April 07, 2015, 09:54:17 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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 = ...
  }
});
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 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


Logged

-- Licensed User --
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!