SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    checking every textbox in a array is filled in

    Hi guys

    Have a bit of a issue. I need to check that every

    licensenumber[] text box is filled in

    If i try to pass it as a array it does not work.

    Here is my code

    PHP Code:
    <script Language="JavaScript">
    <!-- 
    function 
    Blank_TextField_Validator()
    {
    // Check the value of the element named text_name
    // from the form named text_form
    if (text_form.licensenumber.value == "")
    {
    // If null display and alert box
    alert("Please fill in the text field.");
    // Place the cursor on the field for revision
    text_form.licensenumber.focus();
    // return false to stop further processing
    return (false);
    }
    // If text_name is not null continue processing
    return (true);
    }
    -->
    </script>




    <form action=checkout.php method=post  onsubmit="return Blank_TextField_Validator()" name="text_form">

    <input name=licensenumber[]>


    <input name=licensenumber[]>
    <input type=submit name=submit value="Proceed To Checkout">

    </form> 


    How can I check that both fields have been filled out?


    Regards

    Chris

  2. #2
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much. This worked perfect is there a away to add it so it check if another field has also been filled in?

    So would appear like this

    Pop up Box


    - Please enter a licence number
    - Please enter your name
    Thanks in advance


Bookmarks

Posting Permissions

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