Results 1 to 8 of 8

Thread: MessageBox and CheckBox

  1. #1
    Ext JS Premium Member
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    178

    Question MessageBox and CheckBox

    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.

    Code:
    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.');
    	}
    })

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Not without changing the internals of the message box, I don't think you can.

  3. #3
    Ext JS Premium Member
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    178

    Default

    OK...

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

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4

    Default

    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.

  5. #5
    Ext JS Premium Member
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    178

    Question How would I process this form server side?

    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

    Code:
    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();
    	
    };

  6. #6
    Ext JS Premium Member
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    178

    Default

    Bump

  7. #7
    Ext JS Premium Member
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    178

    Default

    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?

  8. #8
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •