need help with JavaScript arrays...want to store input from HTML form into JS array and then display it.

They have: 3 posts

Joined: Mar 2009

prob solved

He has: 698 posts

Joined: Jul 2005

I don't see any HTML. I assume the part that says "Name GenderMaleFemale" was HTML code but you didn't wrap it in code tags. It's hard to say what's happening without seeing the HTML.

The only advice I can give is to use IDs instead of running through the names of the elements. It always seems easier to me to assign each element (where appropriate) an ID and then use document.getElementById("id_of_element") to reference it. That's all I can really advise without seeing the HTML.

Kurtis

They have: 3 posts

Joined: Mar 2009

problem solved

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Hi Namu,

I have enabled your validation function and enabled some labels and stuff (see attached)

BTW I looked for a "textarea" and could not find the HTML tag - you are sending the content as innerHTML to a div, which is fine, but it ain't a "textarea"

another useful technique is to write the form values to a flat .js file that can then be read back into the page - using PHP file functions. It's a little more advanced, but lets you store and retrieve the form input.

I plan to post it as a project soon (actually, it was part of a project to create a scrollable div - without scrollbars - that contains event listings that can be managed from a form-based mini-cms)

They have: 3 posts

Joined: Mar 2009

Hello decibel.places

Thank you for your reply and the attachment. It makes more sense now how to get the array working. thank you.

Yes, opps sorry i somehow missed the textarea html code...not sure how. But now that I know how to display the radio button value I'll give the textarea a go myself. If not, I'll post my problem again.

thanks

Namrita

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.