Welcome to Axure Community Site Sign in | Join | Help
in Search

Indicating radio button and check box states via variables

Last post 12-02-2008, 6:53 PM by victor. 5 replies.
Sort Posts: Previous Next
  •  10-18-2008, 11:00 PM 3503

    Indicating radio button and check box states via variables

    I am using Axure RP 5.0 and trying to set the state of radio buttons and check boxes via variables without success. On page 1, there's a form and I store radio button and check box settings to variables on submit.  On page 2, I also have a form and I use the OnPageLoad event to set the state of radio buttons and check boxes via the stored variables.  Except ... it's not working. It works for the variables I set for drop-down menus and text fields, but not for radio buttons and check boxes.  Is there something different about radio buttons and check boxes that I'm missing? Thanks!
  •  10-19-2008, 10:37 PM 3504 in reply to 3503

    Re: Indicating radio button and check box states via variables

    You should be able to set a variable value equal to the "check state of" a radio button or check box and then on the next page use the OnPageLoad to set the check state of a radio button or check box to that variable value.

    Is it possible for you to send you .rp or a sample to support@axure.com so we can see what the issue is?

  •  10-20-2008, 11:42 AM 3506 in reply to 3504

    Re: Indicating radio button and check box states via variables

    That's exactly what I was trying, but it didn't seem to work right. I am sending along a sample. Thanks!
  •  10-20-2008, 2:48 PM 3510 in reply to 3506

    Re: Indicating radio button and check box states via variables

    Thanks for the sample. We identified the issue and will have a fix in the next update.

    In the meantime, this can be fixed with a change to a javascript file... 

    If you browse to the folder where Axure RP is installed (usually C:\Program Files\Axure\Axure RP Pro 5) and then go to the sub directory DefaultSettings\Prototype_Files\Resources, there is a file called axurerp_pagescript.js.

    If you open that file in Notepad and search for "SetCheckState" you will find the code for that function. It should look like this.

    function SetCheckState(id, value) {
    var boolValue = Boolean(value);
    document.getElementById(id).checked = boolValue;
    }

    Replace it with this and that should resolve the issue.

    function SetCheckState(id, value) {
    var boolValue = Boolean(value);
    if (value == 'false') {
    boolValue = false;
    }
    document.getElementById(id).checked = boolValue;
    }

    If you browse to the folder where Axure RP is installed (usually C:\Program Files\Axure\Axure RP Pro 5) and then go to the sub directory DefaultSettings\Prototype_Files\Resources, there is a file called axurerp_pagescript.js.

    If you open that file in Notepad and search for "SetCheckState" you will find the code for that function. It should look like this.

    function SetCheckState(id, value) {
    var boolValue = Boolean(value);
    document.getElementById(id).checked = boolValue;
    }

    Replace it with this and that should resolve the issue.

    function SetCheckState(id, value) {
    var boolValue = Boolean(value);
    if (value == 'false') {
    boolValue = false;
    }
    document.getElementById(id).checked = boolValue;
    }

  •  12-02-2008, 11:53 AM 3791 in reply to 3510

    Re: Indicating radio button and check box states via variables

    I am having this same issue.  (trying to set radio buttons based on variable values in the page interactions of the master items)

    I thought perhaps this fix would do the trick, however, it appears my .js file is already been fixed (I'm using version 5.1.0.1699).  But the problem still remains.

    In my case, I'm trying to set the check status of 6 variables and only the last 1 (in whatever order I do them) appears to be checked.

    Any help?

     Thanks,

     Chris 

  •  12-02-2008, 6:53 PM 3794 in reply to 3791

    Re: Indicating radio button and check box states via variables

    For those following this thread... it looks the issue was that the radio buttons were assigned to the same group so when the last radio button was set to checked it automatically unchecked the others.
View as RSS news feed in XML