Hello,
I am stuck... Any help will be much appreciated.
After the user submits the form which is located in Window, there is refresh function from a new URL:
$('#windowPopUp').window('refresh', '/saoperatoro/editUser.php?id='+data.user);
the refresh URL loads new form. My question is how to add
$('#...').form('submit', {... to the form that was loaded after refreshing the window?
Here is the full code:
function CreateOperator(){
$.messager.progress({ title: 'მიმდინარეობს მონაცემების შენახვა', msg: 'გთხოვთ, დაელოდოთ...' });
$('#CreateOperator').form('submit', {
url: '/api-submitCreateOperator',
onSubmit: function(){
var isValid = $(this).form('validate');
if (!isValid){
$.messager.progress('close'); // hide progress bar while the form is invalid
}
return isValid; // return false will stop the form submission
},
success: function(data){
$.messager.progress('close'); // hide progress bar while submit successfully
var data = eval('(' + data + ')'); // change the JSON string to javascript object
if (data.success){
//$('#windowPopUp').window('refresh', '/saoperatoro/editUser.php?id='+data.user);
$('#windowPopUp').window({
title: 'მომხმარებლის რედაქტირება',
width: '80%',
height: 600,
modal: true,
resizable: true,
closeAnimation: 'hide',
minimize: 'animate',
collapsible: false,
href: '/saoperatoro/editUser.php?id='+data.user,
footer: '#windowPopUpFooter',
onBeforeLoad: function() {
$(this).window('hideFooter');
$.messager.alert('წარმატებით შესრულდა',data.message);
},
onLoad: function() {
$(this).window('showFooter');
$(this).window('footer').html('<a href="#" class="easyui-linkbutton" iconCls="icon-ok" style="width:80%;height:32px">Register</a> <a href="#" class="easyui-linkbutton" iconCls="icon-ok" style="width:20%;height:32px">Cancel</a>');
$(this).window('footer').css('padding', '5px');
},
onMinimize: function() {
var contents = $('#windowPopUp').contents();
var id = 'create-operator';
var title = '<uniqueID>' + id + '<\/uniqueID> მომხმარებლის შექმნა';
var tabPanel = $('#wu-tabs');
if (tabPanel.tabs('exists', title)) {
tabPanel.tabs('select', title);
return false;
}
tabPanel.tabs('add', {
id: id,
title: title,
content: contents,
fit: true,
cls: 'pd3',
closable: true
});
}
});
$('#operatorsIndex').datagrid('reload');
}
if (data.error){
$.messager.alert('შეცდომა',data.message,'error');
}
}
});
}