I got a problem... I'm building a CMS for a site and I'm extensively
using mootools.
The forms are submited through a Request.HTML:
This is the complete javascript code:
[code=text]
window.addEvent("domready", function(){
if((objForm = $("frmGeneralSiteSettings")))
{
objForm.addEvent("submit", function(e){
new Event(e).stop(); // stop the form submission
var url = objForm.getAttribute("action");
var wndMessage = new MochaUI.Window({
id: "wndProcess",
title: "Information",
type: "modal",
content: "<div class=\"ajaxModalMessage
\">Processing...</div>",
closeColor: [102,102,102],
headerColor: [102,102,102],
headerStartColor: [255,255,255],
headerStopColor: [220,227,235],
width: 250,
height: 36,
onContentLoaded: function(windowEl){
var request = new Request.HTML({
url: url,
onSuccess: function(responseTree,
responseElements, responseHTML, responseJavaScript){
MochaUI.closeWindow(MochaUI.currentModal);
new MochaUI.Window({
id: "wndNotify",
type: "modal",
title: "Message",
content: responseHTML,
width: 500,
height: 36,
closeAfter: 2500,
onCloseComplete: function(){
window.location.reload(true);
}
});
},
onFailure: function(instance){
MochaUI.closeWindow(MochaUI.currentModal);
MochaUI.notification("There has been an
error. The changes were NOT saved. If the error continues please
contact AMDev support team (<a href=\"http://support.amdev.com.mx\"
rel=\"external\">http://support.amdev.com.mx</a>).", {
id: "wndNotify",
width: 500,
y: 37,
height: 50,
closeAfter: 5000,
onContentLoaded: function(){
SetupExternalLinks();
}
});
}
});
request.post(objForm);
}
});
scroll(0, 0); // scroll to top of page to see
the message
});
}
});
[/code]
When the button is clicked a modal window is created with a
"Processing" message... onContentLoaded of this modal windows it fires
the request which actually sends the form through a Request.HTML:
[code=text]
var request = new Request.HTML({some options to handle the request
response});
request.post(objForm);
[/code]
The objForm has been previously set to $("frmGeneralSiteSettings").
So, now my problem is that some of the textboxes in the form may be
blank (empty string) but when they are posted the Request.HTML object
seems to strip them out. I need them to be posted as this textboxes
are dynamically named and there's no way I can know if they are blank
if they are not sent (I navigate through the $_POST array in PHP so if
they are not there they don't get updated).
Is this a bug in Request.HTML? (as the proper working is that the
empty textboxes are sent with an empty value) (I've already checked
witha simple form and no mootools).
Any help?