80 users online (0 members and 80 guests)  

  Results 1 to 1 of 1


  1. Populate fields by javascript using MYSQL    Forum: Javascript Forum
    Replies: 0
  2. Replies: 1
  3. How do I populate nested drop down lists?    Forum: CGI Perl Forum
    Replies: 1
  4. Help to populate DIV from an array    Forum: Javascript Forum
    Replies: 3
  5. Sending selected form fields    Forum: HTML Forum
    Replies: 1
  1. #1
    Working123's Avatar
    New User

    Join Date
    Mar 2007

    Populate fields when checkbox selected

    I have a form with 5 rows and each row has 5 i/p textboxes to accept address details like street name, apt no, city, state and zipcode. There is a checkbox before the textbox in each row. When i click on the checbox i want the data to b populated in the text boxes.
    I have created the form in HTlML and written a function in Javascript for onclick. However the flds r not getting populated with the data. Can anyone pls help me.
    This is a partcular code that i tried with and actually I have tried many other things too... but

    <script LANGUAGE="JavaScript">
    function copy911Address(indx) {
    var level = indx;
    var state;
    eval("document.ciForm.street"+indx).value= "760 Pimlicon Pl";
    document.ciForm.houseNo[indx].value = "None";
    document.ciForm.city[indx].value = "Suwanee";
    document.ciForm.state[indx].value = "GA";
    document.ciForm.zipcode[indx].value = "30024";
      <form name="ciForm">
       <input type="checkbox" value="1" name="sameAs911To1" 
       <input type="text" value="" name="street0">
       <input type="text" value="" name="houseNo0">
       <input type="text" value="" name="city0">
       <input type="text" value="" name="state0">
       <input type="text" value="" name="zipcode0">
       <br><input type="checkbox" value="2" name="sameAs911To2" 
       <input type="text" value="" name="street1">
       <input type="text" value="" name="houseNo1">
       <input type="text" value="" name="city1">
       <input type="text" value="" name="state1">
       <input type="text" value="" name="zipcode1">
       <br><input type="checkbox" value="3" name="sameAs911To3" 
       <input type="text" value="" name="street2">
       <input type="text" value="" name="houseNo2">
       <input type="text" value="" name="city2">
       <input type="text" value="" name="state2">
       <input type="text" value="" name="zipcode2">
       <br><input type="checkbox" value="4" name="sameAs911To4" 
       <input type="text" value="" name="street3">
       <input type="text" value="" name="houseNo3">
       <input type="text" value="" name="city3">
       <input type="text" value="" name="state3">
       <input type="text" value="" name="zipcode3">
       <br><input type="checkbox" value="5" name="sameAs911To5" 
       <input type="text" value="" name="street4">
       <input type="text" value="" name="houseNo4">
       <input type="text" value="" name="city4">
       <input type="text" value="" name="state4">
       <input type="text" value="" name="zipcode4">
    Last edited by vinyl-junkie; 03-23-2007 at 03:40 PM. Reason: Added code tags

Tags for this Thread