Hardwarez Posted November 3, 2007 Share Posted November 3, 2007 I have a java script date picker. This works great: <input type=button value="Date" onclick="displayDatePicker(\'Date\', false, \'ymd\', \'-\');">     <input size="8" MAXLENGTH="10"name="Date" value="'.$today.'"> This is in a loop that generates a multiple froms; one long form really. Any way I am passing data with the form and because it repeats often I have to change the variables so I can access them in a whil loop later. Running a loop I am changing my vars by adding the counter number to the var name. I.E. the name set in the form is changed from date to date1 ect.. When I change the above code to this: <input type=button value="Date" onclick="displayDatePicker(\'Date\', false, \'ymd\', \'-\');">     <input size="8" MAXLENGTH="10"name="Date"'.$n.' value="'.$today.'"> It stops working!! Clicking the date button does nothing when I make that change. What am i doing wrong ??? Why does this break the script? Quote Link to comment Share on other sites More sharing options...
emehrkay Posted November 3, 2007 Share Posted November 3, 2007 it looks like the first parameter of the displayDatePicker() function is the name of the element where you want the return value inserted. You changed the name of the text field to "DATE . $n", so the call to the displayDatePicker() should reflect that change as well. Quote Link to comment Share on other sites More sharing options...
mainewoods Posted November 3, 2007 Share Posted November 3, 2007 on this part of your code: "name="Date"'.$n.' value=" that double quote after: name="Date" should not be there. do it like this instead: "name="Date'.$n.'" value=" the double quote is after the single quote after the .$n. Quote Link to comment Share on other sites More sharing options...
Hardwarez Posted November 9, 2007 Author Share Posted November 9, 2007 It was an html error. I forgot to add my counter value to the name label of the name attribute.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.