Display a jQuery Dialog/Popup, then set a hidden field using the result of the dialog

Posted by Dan Harris on Stack Overflow See other posts from Stack Overflow or by Dan Harris
Published on 2011-01-04T15:47:52Z Indexed on 2011/01/04 16:54 UTC
Read the original article Hit count: 161

Filed under:
|
|
|

The Problem

I have a page with a form on. It has a hidden field called: generic_portrait

I want the user to click a link "select portrait"

This will open a Dialog/Popup using jQuery, based on a dropdown completed earlier in the form. If the value of the dropdown called "gender" is "male" then show male options, if "gender" is set to "female" show female options.

Each portrait has a radio button, each with a name assigned "male1", "male2" etc

Depending on the radio button selected in the popup, I want the hidden field to be set to match this.

The Questions

What is the best way to show a dialog/popup using jQuery, different depending on a dropdown box on the page. Use Javascript to see what is selected, then show a corresponding Div?

I can do the check to see what the dropdown is set to using jQuery, but how can I then shown a specific popup based on that?

Once i've popped it up, how do I take the value assigned to the selected radio box, and set the hidden field called "generic_portrait" to this value.

Why i'm asking

Normally I would figure this out myself, as i'm sure it's not that difficult, but I don't use Javascript and/or PHP very often, and this is due for a client urgently. So I would really, really appreciate some help on this one.

Thanks for all replies in advance.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript