Skip to content

Instantly share code, notes, and snippets.

@suvene
Created May 14, 2014 13:18
Show Gist options
  • Save suvene/34ed82321085d81e7c73 to your computer and use it in GitHub Desktop.
Save suvene/34ed82321085d81e7c73 to your computer and use it in GitHub Desktop.
function spderSubmit(formName, method, action, controllerResourceName, subsystemName) {
openLayer();
var pathNames = (location.pathname + '/').split('/');
if (method == undefined) {
method = 'get';
}
if (subsystemName == undefined) {
subsystemName = pathNames[1];
}
if (controllerResourceName == undefined) {
controllerResourceName = pathNames[2];
}
if (action == undefined) {
action = pathNames[3];
}
var target = location.protocol + '//' + location.hostname + '/' + subsystemName
+ '/' + controllerResourceName + '/' + action;
var hdnDoMethod = $(document.createElement('input'));
hdnDoMethod.attr({id:'do' + method, name:'do' + method, type:'hidden', value:'1'});
form = $('#' + formName);
form.append(hdnDoMethod);
form.attr('action', target);
form.attr('method', method);
$.each($(".datepicker"), function() {
set_date_deleted(this);
});
$.each($('.comma3'), function() {
set_comma3_deleted(this);
});
$.each($('*[disabled]'), function() {
$(this).attr('disabled', false);
});
gspderSubmitTriggers.forEach(function(func) {
if (typeof func == 'function') {
func(formName, method, action, controllerResourceName, subsystemName);
}
});
form.submit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment