We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

Multiple Restore buttons on a CRF

Hi All,

I'm having trouble with my restore buttons. I thought maybe it was because I had multiple on a page, so then I made them numerical changing undoradio1 to undoradio2 and radioGroup1 to radioGroup2 and so on down the line. It's still not working though. I put the jquery code below. I put this code in my right_item_text.

Do any of you know what I am doing wrong? Please help!

Thank you,

Sami 

<img id="undoradio2" src="images/bt_Restore.gif">
<script src=""includes/jmesa/jquery.min.js"">// for OC versions before 3.1.4, use jquery-1.3.2.min.js !</script>
<script lang=""Javascript"">
$.noConflict();
jQuery(document).ready(function($){
 $(""#undoradio2"").click(function (e) {
 for (i = 0; i < radioGroup2.length; i++) { radioGroup2[i].checked = false;  }
 radioGroup2.change();
  });
 // identify the group radio buttons
 var radioGroup2 = $(""#undoradio2"").parent().parent().find(""input"");
});    
</script>


Comments

  • jmacminn1jmacminn1 Posts: 18
    Hi Sami,

    From a quick review of the code you posted, I do not see any issues. I have used the following to undo radio buttons, and have not experienced any issues:

    <img id="undoradio1" src="images/bt_Restore.gif">
    <script src="includes/jmesa/jquery.min.js">// for OC versions before 3.1.4, use jquery-1.3.2.min.js !</script>
    <script lang="Javascript">
    $.noConflict();
    jQuery(document).ready(function($){
     $("#undoradio1").click(function (e) {
     for (i = 0; i < radioGroup1.length; i++) { radioGroup1[i].checked = false;  }
     radioGroup1.change();
      });
     // identify the group radio buttons
     var radioGroup1 = $("#undoradio1").parent().parent().find("input");
    });    
    </script>


    As you mentioned, in order to have multiple undo radio buttons on the same form, you must change the identifiers for radioGroup and undoradio. You are welcome to try this code in your own forms to see if it resolves the issue. The only difference that I noticed is the use of double quotes around the item identifiers (i.e. ""#undoradio2"" as opposed to "#undoradio2"). 

    I have attached an example CRF that I created that contains two different undo radio buttons, which may also help!

    Best,
    Jessica
  • samanthareedsamanthareed Posts: 6

    Thanks Jessica! Those double quotes were the reason!

    Thank you for your careful review of the code. I missed that every time I compared the two!


    Sami

  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    via Email
    The first thing that jumps out is that there are two sets of double quotes
    in some places.

    The next thing is that the structure doesn't seem right. There are 3 main
    components to address: identify your variables (e.g. the radio controls),
    define a function for what should happen to the variables (e.g. unset on
    click), attach the function to an event (e.g. onclick of a button).

    At the moment it looks like the code will only maybe try to unset radios
    when the page has finished loading.

    Have a look at the examples on trialdatasolutions and follow the structure,
    which is generally as I've described above.
    On 18/10/2014 10:13 AM, "samanthareed"
This discussion has been closed.