Results 1 to 5 of 5

Thread: Stopping Form Submit

  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    10

    Default Stopping Form Submit

    I have a form with a submit button and I need to show a message box with two buttons - Yes/No on submit. If the user selects yes, I need to go ahead and submit the form, else, if the user clicks no I need to cancel the submit. I know how to set up the message box, but I don't know how to cancel a form submit. Any help would be greatly appreciated.

  2. #2
    Sencha User
    Join Date
    Jun 2009
    Location
    Colorado
    Posts
    51

    Default

    Instead of making the submit button actually submit the form, why don't you make it just pop up your message box? If the user clicks Yes, then you can submit the form.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    10

    Default Stopping form submit

    Well, there is another wrinkle. The message box popup is based on a select option in a combo box. So, I will only show the popup if the option selected is "Mustang", for any other choice, the form is to be submitted.

    Also, is there a way to get the selected item's text or index after the submit button is clicked?

    Thanks very much,
    Shibani

  4. #4
    Sencha User
    Join Date
    Jun 2009
    Location
    Colorado
    Posts
    51

    Default

    Not seeing the issue here. Have the button's handler check to see if "Mustang" is selected - if yes, show the popup - if not, submit the form.

    I am not familiar with an easy method for finding which field in your form has focus. You could either move through the fields and check manually, or put focus listeners on your fields in order to keep track of the last field that got focus..

  5. #5
    Sencha User
    Join Date
    Jun 2010
    Posts
    10

    Default

    Okay, I see what your saying. As far as finding out what option was selected in the combo box, I tried this as a test:

    Ext.onReady(function(){
    var el = Ext.get('mySelectBox');
    el.on('change', function(){
    alert(el.selectedIndex);
    });
    });

    but the alert comes back as 'undefined'. I was expecting the alert to say 0 or 1, depending on what I selected.

Similar Threads

  1. How to submit the grid value using form submit?
    By ajax&me in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 28 Sep 2009, 6:30 AM
  2. form.submit doesn't call url in form submit action
    By webwolfi in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 26 Apr 2009, 10:16 AM
  3. tree: submit checkboxes with form.submit
    By perler in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 24 Mar 2008, 4:49 AM
  4. Form without submit button, handling submit with shift+enter...
    By violinista in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 5 Jun 2007, 12:02 AM
  5. ID of submit within form masks submit function
    By aconran in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 19 Feb 2007, 12:08 AM

Posting Permissions

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