tags:

views:

40

answers:

3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
                <title> </title>
                <style type="text/css">
                </style>
                <script type="text/javascript">
                function setPrice(selObj){
                        document.forms['f1'].price.value = selObj.options[selObj.options.selectedIndex].value;
                }
                </script>
        </head>
        <body>
                <form name='f1'>
                        <select name="category" onchange='javascript: setPrice(this);'>
                                <option value=''>Select an option</option>
                                <option value="41">Men</option>
                                <option value="39">Women</option>
                                <option value="20">Under 18's</option>
                        </select>
                <input name="price" type="hidden" value="" />
</form>
        </body>
</html 

Are there any problems with the code,because I did not see the update value in hidden field ?

+1  A: 

What is the question? Your script is working fine.

dmrnj
Should be a comment.
Felix Kling
are sure it works fine??
python
+1  A: 

Answering: YES!

You can change the value of a hidden with onchange. You already did this in your code.

See: http://jsfiddle.net/FwTgb/

Topera
A: 

The problem is that my controller is not able to ready the value even client-side has value already set. the variable hidPopUpMsg is nothing, even client side code have value of N.

Annie Chen