Master Posted January 29, 2018 Report Share Posted January 29, 2018 I want to have a radio button in which user can select to either search for today data which passes today's date for both from and to, or tomorrow or select dates. Any ideas? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted January 29, 2018 Report Share Posted January 29, 2018 You need to have JS on your form. Let's say you have: Virtual 1 as radio button with these values: 1- Today 2- Tomorrow 3- Enter dates Virtual 3 (pass from), virtual 4 (passes to). Add HTML block around these two, in the HTML Block above add: <table id="mydates" style="display:none;"><td> and HTML Block below add: </td></table> The following code will go to the footer: <script> function assign(){ if (document.getElementById('cbParamVirtual10').checked){ document.getElementById('mydates').style.display="none"; document.getElementById('cbParamVirtual3').value = '[@cbTimestamp*]'; document.getElementById('cbParamVirtual4').value = '[@cbTimestamp*]'; } else if (document.getElementById('cbParamVirtual11').checked){ document.getElementById('mydates').style.display="none"; f_date(); } else if (document.getElementById('cbParamVirtual12').checked){ document.getElementById('mydates').style.display="block"; document.getElementById('cbParamVirtual3').value = ''; document.getElementById('cbParamVirtual4').value = ''; } } function f_date(){ var today = new Date('[@cbTimestamp*]'); var dd = today.getDate()+1; var mm = today.getMonth()+1; var yyyy = today.getFullYear(); document.getElementById('cbParamVirtual3').value =mm+'/'+dd+'/'+yyyy; document.getElementById('cbParamVirtual4').value = mm+'/'+dd+'/'+yyyy; } document.getElementsByName('cbParamVirtual1')[0].onchange = assign; document.getElementsByName('cbParamVirtual1')[1].onchange = assign; document.getElementsByName('cbParamVirtual1')[2].onchange = assign; </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.