EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: peter on April 10, 2012, 03:35:53 AM



Title: Adding custom data to a form
Post by: peter on April 10, 2012, 03:35:53 AM
I have a form and I need to send extra data with the form.
The data to be sent is a complex structure, so using a hidden input element
in the form isn't going to be enough.

I had a look at the form plugin, and there is a reference to "data".
I tried adding it with 'data' as shown, but that doesn;t work.

 $(formId).form('submit',{ 
   url: url,
        data: {xxx: 'yyy'},
        onSubmit: function(){ 
            return $(this).form('validate'); 
        }, 
        success: function(result){ 
 ...

Thanks,

Peter


Title: Re: Adding custom data to a form
Post by: Kevin on April 13, 2012, 04:10:38 PM
Hi Peter

I've done something similar but I just sent this data as part of the url post. ie.

url = 'PHP/update_data.php?part=0&user=1001&status='+row.status;

The framework will append your form data to this. Of course, if your data is a lot more complexed, you could send a $.post after receiving a success to your form data.