View Full Version : layer & javascript problem ......

07-05-2003, 05:59 PM

I have set 2 radio buttons. (A, and B, etc). By default button A is checked, a hide layer action (onClick) is set to hide some fields. If user select B(onClick) then the layer with 3 fields will show so user can enter some data.
(hence by default the layer is set to hide when the page first load)

Now assuming user had selected option B and entered some details.....

Everything works fine until next page - The confirmation page has 2 buttons.

Confirm - which will take user to the registration process page.
Back - if user decided to edit the data.

The code on the back button :
<INPUT TYPE="button" NAME="edit" VALUE=" Back " ONCLICK="javascript:history.back(-1)" >

when it jumps back to the first page the layer disappear even if user has selected option B and entered some details already. The only way to get the field (and data) back is to select option A and then B again.

is there anyway to get round this?


07-05-2003, 08:36 PM
Maybe something like:

function showExtraFields(show) {
document.getElementById("layerId").style.display=(show ? 'block' : 'none');

document.onload=function() {
if (document.forms["formName"]["radioB"].checked){
} else {

This way the layer will be shown according to the status of radio buttons...

07-05-2003, 09:29 PM
Very Clever, many thanks