EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: bakoma on July 05, 2014, 05:49:49 PM



Title: Way to use "Form onLoadSuccess event"
Post by: bakoma on July 05, 2014, 05:49:49 PM
I need to do something after "Form onLoadSuccess event". I cannot find an example about how to use it.

Originally, I tried:
$('#myform').form('load', 'mywebservice.php');
myFunctionToDoSomethingWithFormFields();

but myFunctionToDoSomethingWithFormFields() just executed too soon before the form being filled data from webservice.

Now I am doing:
$('#myform').form('load', 'mywebservice.php');
window.setTimeout(function () {
   myFunctionToDoSomethingWithFormFields();
}, 1000);

assuming the data will be filled into the from within 1 second. This is just a workaround.

Although the document says there is a onLoadSuccess event, there is no example showing the usage.

I tried the following with no luck:
$('#myform').form('load', 'mywebservice.php',{onLoadSuccess:' myFunctionToDoSomethingWithFormFields();'});

$('#myform').onLoadSuccess=function(){
    myFunctionToDoSomethingWithFormFields();
};


Title: Re: Way to use "Form onLoadSuccess event"
Post by: stworthy on July 06, 2014, 01:43:58 AM
Please try this:
Code:
$('#myform').form({
onLoadSuccess:function(data){
console.log(data)
}
});
$('#myform').form('load','mywebservice.php')


Title: Re: Way to use "Form onLoadSuccess event"
Post by: bakoma on July 07, 2014, 09:06:46 AM
It works great!. Thanks  a lot.