mdav20 Posted May 9, 2017 Report Share Posted May 9, 2017 Is there a way to automatically check a yes/no box if another field has data in it? For example I have a yes/no if a shift is complete I would like it switched to yes once the end hrs has data. I need to be able to do this in a report though if possible because of the way I have it set up. I'm thinking it will be javascript but not sure how to do it. Thanks Quote Link to comment Share on other sites More sharing options...
Mathilda Posted May 10, 2017 Report Share Posted May 10, 2017 16 hours ago, mdav20 said: Is there a way to automatically check a yes/no box if another field has data in it? For example I have a yes/no if a shift is complete I would like it switched to yes once the end hrs has data. I need to be able to do this in a report though if possible because of the way I have it set up. I'm thinking it will be javascript but not sure how to do it. Thanks Hi, I would recommend checking length of the value. You may insert the following script in the footer of details datapage: <script> window.onload= function() { if (document.getElementById("EditRecordYour_field").value.length>1) { document.getElementById("EditRecordcheck_box_field_name").checked=true; } } </script> Don't forger to change fields names in my script Cheers! mdav20 1 Quote Link to comment Share on other sites More sharing options...
mdav20 Posted May 10, 2017 Author Report Share Posted May 10, 2017 Thanks for the information, I can't seem to get it to work still. Should I type out the field names and leave the ( ) or should I use the drop down list to select the field and type of field which adds the [ ] Thanks again Quote Link to comment Share on other sites More sharing options...
phenom94 Posted May 12, 2017 Report Share Posted May 12, 2017 Hi mda20, Try the code below and add it to the header of the Details page. As always, change the field names as needed: <script> window.onload= function() { if (document.getElementById("EditRecordComments").value.length>0) { document.getElementById("EditRecordYesNo").checked=true; } else if (document.getElementById("EditRecordComments").value.length==0) { document.getElementById("EditRecordYesNo").checked=false; } } </script> Quote Link to comment Share on other sites More sharing options...
Mathilda Posted May 15, 2017 Report Share Posted May 15, 2017 On 5/10/2017 at 11:57 AM, mdav20 said: Thanks for the information, I can't seem to get it to work still. Should I type out the field names and leave the ( ) or should I use the drop down list to select the field and type of field which adds the [ ] Thanks again You need to insert your field names after EditRecord, for example if your field name is Status, the syntax will be: ("EditRecordStatus"). More information can be found here. Please note, Java Script is case sensitive. Hope that helps. Quote Link to comment Share on other sites More sharing options...
mdav20 Posted May 15, 2017 Author Report Share Posted May 15, 2017 Thank you guys for your help, I've tried both and just can't seem to get it to work. Maybe because this report is receiving parameters that's why I'm struggling? I might have to just hope the users can follow directions and check the box themselves. 6 hours ago, Mathilda said: You need to insert your field names after EditRecord, for example if your field name is Status, the syntax will be: ("EditRecordStatus"). More information can be found here. Please note, Java Script is case sensitive. Hope that helps. On 5/12/2017 at 5:05 PM, phenom94 said: Hi mda20, Try the code below and add it to the header of the Details page. As always, change the field names as needed: <script> window.onload= function() { if (document.getElementById("EditRecordComments").value.length>0) { document.getElementById("EditRecordYesNo").checked=true; } else if (document.getElementById("EditRecordComments").value.length==0) { document.getElementById("EditRecordYesNo").checked=false; } } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.