Results 1 to 3 of 3

Thread: PHP & JavaScript

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question PHP & JavaScript

    Is it possible to restrict a .php file to process after 'Submit' if one or more text boxes becomes empty using JavaScript ? Please show me the one.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: PHP & JavaScript

    Can you rephrase that question?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: PHP & JavaScript

    Is this what you want?

    This won't submit the form until a value has been entered.

    HTML Code:
    <script language="javascript">
    
    function validate(theform) {
    
    if (theform.YourField.value=="") {
    alert("Pleaes enter a value");
    theform.YourField.focus()
    return false; }
    
    }
    
    </script>
    PHP Code:
    <form method="post" action="YourPage.php" onSubmit="return validate(this)">
    <
    input type="text" name="YourField">

    <
    input type="submit" name="submit" value="Submit">
    </
    form

Posting Permissions

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



Click Here to Expand Forum to Full Width