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 4 of 4
  1. #1
    blk
    blk is offline
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy count related input values!

    I need to write a javascript function. There are two fields "Number of Items" and "Item ID". "Item ID" has 5 input fields. If the field "Number of Items" is chosen as 1, then "Item ID" needs 1 Id input. If the "Number of Items" is 2, 2 ID inputs are needed and so on. Could anybody help me in writing this function please. Thanks in advance.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD><TITLE>Accomodation form</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <META content="MSHTML 6.00.2800.1458" name=GENERATOR>

    </HEAD>

    <BODY vLink=#006600 link=#3333ff bgColor=white>


    <FORM action=" " method=post>
    <h1>Enter the details</h1>
    <TABLE cellSpacing=0 cellPadding=0 border=0>

    <TR>
    <TD align=left>Number of Items</TD>
    <TD width="84"><INPUT maxLength=55 size=10 name=number></TD></TR>
    <TR>
    <TD align=left>Item ID</TD>
    <TD width="84"> <input name=id_1 size=10></TD>
    <TD><input name=id_2 size=10></TD>

    <TD><input name=id_3 size=10></TD>

    <TD><input name=id_4 size=10></TD>

    <TD><input name=id_5 size=10></TD>

    </TR>
    <TR>

    <TD></TD></TR>
    <TR>
    <TD></TD></TR>
    <TR>

    <TD width="200"><INPUT type=submit value=Submit><INPUT type=reset value="Clear Form">
    </TD></TR>

    </TABLE>
    </FORM>
    </BODY>
    </HTML>

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    blk
    blk is offline
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi A1ien51,

    Thanks for the code but it is not working :-(

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    It is not so difficult, but before answering, I would like to know... But if the user inputs 6? or a letter? Wouldn't it be easier to use a select with preset options values?

    By the way, I guess you forgot to specify the type of the input elements. I presumed that they are all type="text"
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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