[Javascript] Hiding forms using <DIV>

Yenan yvisram at iders.ca
Wed Apr 26 09:22:06 CDT 2006


Hi,

I have written a form page that hides/displays a text box depending on 
which radio button is selected. However I am having an issue when I use 
firefox browser.

The sequence of events are as follows:

- First I select the radio button that displays the text box and I enter 
text in it
- Then I submit the form to a cgi script that processes the form
- Now I use the back button to return to the form
- I notice that the radio button is still selected and the text box 
still has the text I had entered earlier.
- Now here's the problem. When I select a different radio button the 
text box disappears but when I submit the form I don't get the selected 
radio button
  passed to the cgi script.

Here's the snippet of my code :

form action="/cgi-bin/ProcessUpgrade.exe" method="post" 
enctype="multipart/form-data">
    <input type="radio" name="UpgradeChoice" value="upgrade" 
onClick="document.getElementById('upgrade').style.display = 'block';"> 
Upgrade Version &nbsp;<br>
    <div id='upgrade' style="display: none;">
    <input name="UpgradeFile" value="" type="file"><br>
    </div>
    <input type="radio" name="UpgradeChoice" value="factory" 
onClick="document.getElementById('upgrade').style.display = 'none';"> 
Factory Default Version &nbsp;<br>
    <input type="radio" name="UpgradeChoice" value="previous" 
onClick="document.getElementById('upgrade').style.display = 'none';"> 
Previous Version &nbsp;<br>
    <input name="sendRequest" value="Send" type="submit">
    </form>



PS: This is a problem only with firefox it works fine with explorer.

I would appreciate any help ...

Thanks,

Yenan



More information about the Javascript mailing list