Radio button parameter query 'checked' option?

(8 posts) (2 voices)
  1. duane, Member

    Hi.

    In the parameter queries, I can't find a way (based on the documentation) for the 'selected' option of a radio button list. I see there is one for select lists (selected) and for checkboxes it is the fourth variable as 'checked' - but the radio button documentation at https://mydbr.com/doc/content/start.userparam.html#par-radio seems to indicate no pre-checked option is possible. Is there a way to do this?

    Related to this, is there a way so that with a radio button list as a parameter query, NO option is preselected/default? Right now, the first option is unless I put in a 'none' option first, and I'd prefer to have them all unselected by default.

    Cheers,

    Duane

  2. myDBR Team, Key Master

    The fourth parameter for the selected radio button is 'selected'. This will set the default radio button state (documentation updated).

    You can deselect the default radio button via JS. Add a class 'noradioselect' to the radio button and use following JS.

    <script>
    $(document).ready(function() { $('.noradioselect input').removeAttr('checked') });
    </script>

    We can add an option to make the noselect radio button available without JS.

    --
    myDBR Team

  3. myDBR Team, Key Master

    The option has been added to parameter options.

    --
    myDBR Team

  4. duane, Member

    Looks great!

    Can you just check one thing and explain another?

    Check: using the 'No selected' option works to not pre-check the first/any of the radio buttons, but in my working code it still seems to return the value of the first option in the radio button. (I tested this by returning the previous radio button parameter value in the subsequent parameter value radio button list). So it may be my code or perhaps the radio buttons display as unselected but still select the value behind the scenes?

    Explain: What is the 'uservalue' in the 4-part radio button parameter query for (since it already had an id and a display value)?

  5. myDBR Team, Key Master

    Did you check the option "Do not remember user's choice"? By default, myDBR remembers user's choises once (s)he has made them (for easier access). When checked, the parameter is not remembered.

    Explain: What is the 'uservalue' in the 4-part radio button parameter query for (since it already had an id and a display value)?

    It is an old feature no longer used. To keep reports working the 'selected' option is still the 4th option (could be nowadays 3rd as well).

    --
    myDBR Team

  6. duane, Member

    Did you check the option "Do not remember user's choice"?

    Yes - I did. I'll keep testing and see if it is something in my code.

    Thanks!

  7. duane, Member

    So I've produced sample code that reproduces the problem that the

    ...in my working code it still seems to return the value of the first option in the radio button....

    What I've found is that if "Do not remember user's choice" + "Optional" + "No selected radiobutton" are selected and the report is submitted with no selection, the radio button parameter after submission shows the first value selected (vs blank). Ideally this would still be blank if nothing has been selected for when the dbr.parameters.show option is used.

    I can provide working code if necessary.

  8. myDBR Team, Key Master

    Duane,
    you can now try the latest build.

    --
    myDBR Team


Reply

You must log in to post.