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.

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.