Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    layer & javascript problem ......

    Hi,

    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?

    James

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    São Paulo, Brazil
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe something like:

    Code:
    function showExtraFields(show) {
        document.getElementById("layerId").style.display=(show ? 'block' : 'none');
    }
    
    document.onload=function() {
        if (document.forms["formName"]["radioB"].checked){
            showExtraFields(true);
        } else {
            showExtraFields(false);
        }
    }
    This way the layer will be shown according to the status of radio buttons...
    /Daniel

  • #3
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    many thanks

    Very Clever, many thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •