HTML Crew - Validation in drop down boxes?

Discussion in 'OT Technology' started by mondaynightmike, Jan 1, 2005.

  1. mondaynightmike

    mondaynightmike New Member

    Joined:
    Aug 10, 2004
    Messages:
    117,672
    Likes Received:
    0
    Location:
    DEFINITELY No *Unlinked* Cock Pics
    Just wondering how can you add validation in to drop down boxes.

    What i mean is:

    I've got one drop down box:

    Code:
     <select name="selectcpu" onChange="update (1)">
     	 <option value="">> Choose A CPU <</option>
     	 <option value="£111.00">Intel Pentium 4 3.0GHz</option>
     	 <option value="£135.00">Intel Pentium 4 3.2GHz</option>
     	 <option value="£40.00">Intel Celeron 320 2.4GHz</option>
     	 <option value="£60.00">Intel Celeron 355 2.8GHz</option>
     	 <option value="£90.00">AMD Athlon 64 3000</option>
     	 <option value="£145.00">AMD Athlon 64 3400</option>
     	 <option value="£90.00">AMD Sempron 3100</option>
     
     	</select>
     	<image name="cpupic" src="images/clear.gif">
     	<input type="text" readonly name="cpuprice" size="6">
     
    and i want it to validate with THIS box:

    Code:
      <select name="selectmb" onChange="update (2)">
     	 <option value="">> Choose A Motherboard <</option>
     	 <option value="£35.00">Asus A7V8X-X</option> <!-- ATHLONS ONLY! --> 
     	 <option value="£70.00">MSI K8N Neo Platinum</option> <!-- ATHLON 64 ONLY! --> 
     	 <option value="£40.00">Asus Socket 478HT</option> <!-- Pentium Celeron ONLY! --> 
     	</select>
     	<image name="mbpic" src="images/clear.gif">
     	<input type="text" readonly name="mbprice" size="6">
     
    Basically i wanna know how i can have an error box pop up saying "processor will only work with selected mother board below" Then select the appropriate mother board.

    so if you selected say the P4 processor it would auto select the mother board what will work with the processor.

    Anyone got any ideas?

    It's only a demo site i'm doing for uni so it's nothing online or running but i'd just like to add a bit of validation to it!

    Thanks.
     
  2. MrMan

    MrMan New Member

    Joined:
    Jul 13, 2004
    Messages:
    308
    Likes Received:
    0
    Validation on client side would be done using Javascript. Cannot be done using purely HTML.
     
  3. mondaynightmike

    mondaynightmike New Member

    Joined:
    Aug 10, 2004
    Messages:
    117,672
    Likes Received:
    0
    Location:
    DEFINITELY No *Unlinked* Cock Pics
    any ideas on how i'd go about doing this in javascript then?
     
  4. OmniFire

    OmniFire *************************

    Joined:
    Oct 19, 2003
    Messages:
    3,778
    Likes Received:
    0
    Location:
    Austin
    make a function in javascript and call it using the onClick or whatever
     
  5. Yep

    Yep Knick knack paddy whack, give the old dog a bone

    Joined:
    Jan 22, 2001
    Messages:
    4,603
    Likes Received:
    0
    Location:
    South Jersey
    Or have the first combo box populate the second combo box with only what you want it to have when the first one changes.

    Shouldn't be too difficult using Javascript even if you only have a mild understanding of it.
     
  6. mondaynightmike

    mondaynightmike New Member

    Joined:
    Aug 10, 2004
    Messages:
    117,672
    Likes Received:
    0
    Location:
    DEFINITELY No *Unlinked* Cock Pics
    Don't suppose you know where i could find a simple population script.

    I've found one what works with country/states etc... and i've managed to modify it but it's got an additonal feature where if you select other it allows you to add [via a text box] another value. And trying to get rid of this code is proving to be a nightmare.
     
  7. urbanBaldGuy

    urbanBaldGuy How does this intarweb thing work?

    Joined:
    Dec 28, 2004
    Messages:
    5
    Likes Received:
    0
  8. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    you're better off not giving them a mobo choice. Afterall, you're only offering 1 per possible socket, so why not leave it off, and you know what mobo to use?

    I HOPE you've got access to PHP on the server... Then you could even have it on seperate pages and then validate server-side what mobo they need to use.

    Or do it like most companies -- different model systems for different platforms.
     
  9. Yep

    Yep Knick knack paddy whack, give the old dog a bone

    Joined:
    Jan 22, 2001
    Messages:
    4,603
    Likes Received:
    0
    Location:
    South Jersey
    I see everyone else already answered your question. If you can't get the additional function out of it, post the code up and I'll take a look.
     

Share This Page