Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2007
    Posts
    217
    Thanks
    25
    Thanked 1 Time in 1 Post

    validating textbox and selectbox

    I want to validate a textbox and a selectbox. The textbox may not be empty and the selectbox may not contain 'Kies een prijsstelling..' otherwise an errormessage is displayed.

    I've got the coding below, but when I test it with the textbox empty and the selectbox focussed on the 'Kies een prijsstelling..' line, the error message ain't displayed. How come ?

    my html:
    Code:
    Prijs*<br /><input id="prijs" name="prijs" style="width:75px;" type="text" value="<?php echo"$prijs" ?>" onblur="this.value=formatCurrency(this.value);" /> &nbsp;of&nbsp; 
    <select name="prijssoort" onchange="document.getElementById('prijs').value = '';">
    <option value="1" selected="selected">Kies een prijsstelling..</option>
    <option value="2">Bieden</option>
    <option value="3">N.o.t.k. (Nader overeen te komen)</option>
    <option value="4">T.e.a.b.</option>
    <option value="5">Ruilen</option>
    <option value="6">Gratis</option>
    </select>
    my php:
    Code:
    if ($prijs=='' && prijssoort=='1'){echo "Prijs of prijssoort is een verplicht veld";}

  • #2
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post
    Code:
    if ($prijs=='' && prijssoort=='1'){echo "Prijs of prijssoort is een verplicht veld";}
    It may help if you had a $ before prijssoort


  •  

    Posting Permissions

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