Jump to content

[SOLVED] Does Javascript work with Form Arrays?


chronister

Recommended Posts

Hey Folks,

 

I have an input form that is dynamically generated via php/mysql. I am trying to add couple small images to it so the user can increment or decrement the values in the field. I have different images that I am going to use, but here is what I am after.

<form name="form">
<!-- this one works -->
<input type="text" name="qty" value="5" >
<input type="button" value="up" onClick="javascript:this.form.qty.value++;" >
<input type="button" value="down" onClick="javascript:this.form.qty.value--;" >

<br><br>

<!-- This one don't work. I am assuming because of the array part [414] -->
<input type="text" name="qty[414]" value="5" >
<input type="button" value="up" onClick="javascript:this.form.qty[414].value++;" >
<input type="button" value="down" onClick="javascript:this.form.qty[414].value--;" >

</form >

 

Can I make the values change on the second one, this is how my form is generated, the 414 part is different for each input field as is the 414 in the javascript. That number or name is dynamic via php and I have to keep it.

 

In the end, there are going to be 80-90 input fields in a 4 across table.

 

Is there a way to make this second one work? p.s. I know nothing of javascript, so I REALLY APPRECIATE any help given.

 

 

 

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.