www.webdeveloper.com
Results 1 to 7 of 7

Thread: [RESOLVED] Return false to stop submit?

Threaded View

  1. #1
    Join Date
    Apr 2009
    Location
    Old Sydney Town
    Posts
    6

    resolved [RESOLVED] Return false to stop submit?

    Hello

    The following snippet sits inside a function that validates various textbox fields, which are validated onsubmit. I have other calculations in other functions and I want to stop the form form submitting if those other calculations don't exist. The "total" is calculated on-the-fly, and if no items are selected, then the total box should be empty.

    Everything else is working perfectly - it's only this part giving me trouble. How do I stop it from submitting the form if no total has been calculated? I've tried different variations on this code:


    Code:
    if(document.getElementById("total").value=="") 
                       {
                            alert("No items selected!");
                            document.getElementById("qty1").focus();
                            return false;
                       }
    
                       else
                       {
                            return true;
                       }

    Thanks!
    Damien
    Last edited by dyingsun; 04-27-2009 at 03:30 PM. Reason: incomplete

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles