PDA

View Full Version : MessageBox and CheckBox



badgerd
30 Jul 2007, 6:04 PM
Is is possible to use a form checkbox within the same MessageBox prompt? If so, how would it be best placed in the code? I would like the checkbox to appear underneath the text box prompt.


Ext.MessageBox.prompt('Lost Password', 'Please enter your registered email address.', function(btn, text){
if (btn == 'ok'){

if (window.ActiveXObject) {
loadDoc=new ActiveXObject("Microsoft.XMLDOM");
loadDoc.async=false;
loadDoc.load('include/resendPassword.cfm?EmailAddress='+text);
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument) {
loadDoc=document.implementation.createDocument("","",null);
loadDoc.load('include/resendPassword.cfm?EmailAddress='+text);
}
alert('Your password has been mailed to you.');
}
})

evant
30 Jul 2007, 9:01 PM
Not without changing the internals of the message box, I don't think you can.

badgerd
30 Jul 2007, 10:04 PM
OK...

Would there be another solution to do what I need? eg: a form that can pop-up as per same way MessageBox works?

brian.moeskau
30 Jul 2007, 11:24 PM
Sounds like you just want a modal BasicDialog. You can easily add any elements you need to a BasicDialog, and just add the appropriate handlers to the buttons to call your function.

badgerd
5 Aug 2007, 8:11 PM
I have tried searching for the correct solution, but have not been able to find one.

In the doformSubmit function, how could i process the form server side with the front end not doing anything?

What I would like to happen is:

1) User enters details in popup
2) User presses Submit
3) Form is processed server side (no redirect etc is to happen)
4) If successful - An email is generated
5) User is notified of success
6) dialog closes/disappears


function lostPassword() {

var LostPasswordform = new Ext.form.Form({id: 'LostPasswordForm'});

this.doformSubmit=function() {

//What do I do here?

LostPasswordform.on('actioncomplete', function() {
this.dialog.hide();
});

}

LostPasswordform.add(
new Ext.form.TextField({
fieldLabel: 'Please enter your registered email address',
name: 'LP_emailAddress',
id: 'LP_emailAddress',
width: 270,
allowBlank: false
}),
new Ext.form.Checkbox({
labelSeparator: '',
boxLabel:'Notify Administrator',
name:'LP_notifyAdmin',
id:'LP_notifyAdmin'
})
);

// Build the dialog box
dialog = new Ext.BasicDialog("lostpassword-dlg", {
autoTabs:false,
width:300,
height:140,
shadow:true,
minWidth:300,
minHeight:140,
proxyDrag: false,
buttonAlign: "center",
collapsible: false,
modal: true,
autoScroll: false
});

LostPasswordform.render(dialog.body);

dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Submit', this.doformSubmit, dialog);
dialog.setDefaultButton(dialog.addButton('Close', dialog.hide, dialog));

dialog.show();

};

badgerd
6 Aug 2007, 3:36 PM
Bump

badgerd
6 Aug 2007, 9:47 PM
Is anyone able to assist me with this issue?

I am trying to make the form submit "siliently" via ajax and cannot seem to make this work at all. What do I need to do to be able to send the form values to another page and get the result back via a JSON call?

brian.moeskau
6 Aug 2007, 9:57 PM
There are multiple ways of submitting form data via Ajax. You can use the form.submit method, or use Ext.Ajax.request if you want more manual control over what gets sent and how. Then you'll want to set up success and failure callbacks to either close the form successfully or show error messages.

What have you actually tried so far? It's much easier for someone to answer questions about code you're having issues with than writing application code for you.