Jump to content

Displaying HTML Form Fields Depending on Another Field


Thauwa

Recommended Posts

Hey folks!

I hope that I posted this in the right section.

 

For some time now, I've been wanting to know how to have HTML form fields of the same form appear/disappear depending on the value of one of the fields in that form itself. Will this require JavaScript? Am I trying to step into something too complex?

 

Here's an example of what I'm trying to learn about:

 

There is a form, which at first displays only a drop-down box with values from "1-5". If the user selects "2", two text fields will appear below the drop-down box. If the user then selects "1", the two fields become one. If "5" is selected, the total number of fields visible will be five.

The five fields available will belong to the same form, and overall, there will be only five text fields present (not 1+2+3+4+5=15). 

Does anyone know how I could achieve this? I just want to get an idea of how to get this done.

 

I hope that I didn't sound confusing.

I will appreciate any help offered, and I thank you for reading!

 

Thanks and Regards,

Thauwa.

Thank you so much for putting me on the right track! 

I found a sample code here: http://anthonygthomas.com/2010/03/14/display-form-fields-based-on-selection-using-jquery/

 

Once again, I thank you for your time and reply.  :happy-04:

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.