Mylene Posted December 22, 2016 Report Share Posted December 22, 2016 Hi, I need to allow deleting record on Details page only when user is typed "Delete" in a field. How can do that? Quote Link to comment Share on other sites More sharing options...
0 Aurora Posted December 22, 2016 Report Share Posted December 22, 2016 Hi Mylene, That's easy. You should add Virtual Field, where users will type "Delete". Use the following code: <SCRIPT LANGUAGE="JavaScript"> var stat=document.getElementById('cbParamVirtual1').value; if (stat ==!'Delete') { document.getElementById("Mod0DeleteRecord").style.visibility = 'hidden'; } </script> Happy Holidays Quote Link to comment Share on other sites More sharing options...
0 djboss1981 Posted December 23, 2016 Report Share Posted December 23, 2016 I've tried this in a details page, and it doesn't seem to work? What could I be doing wrong? I put the code in the footer. Is this correct? Quote Link to comment Share on other sites More sharing options...
0 nightowl Posted December 27, 2016 Report Share Posted December 27, 2016 You can try: <script> var stat = document.getElementById('cbParamVirtualX'); var hideShowDelete = function (event) { if (stat.value.toLowerCase().indexOf('delete') !== -1) { document.getElementById("Mod0DeleteRecord").style.visibility = 'hidden'; } else { document.getElementById("Mod0DeleteRecord").style.visibility = 'visible'; } }; stat.addEventListener('input', hideShowDelete); </script> This revised code has the advantages of: Case insensitivity Ability to respond to user input instead of just the initial value Quote Link to comment Share on other sites More sharing options...
0 Aurora Posted December 28, 2016 Report Share Posted December 28, 2016 Try this one: <SCRIPT LANGUAGE="JavaScript"> document.getElementById("Mod0DeleteRecord").style.display = 'none'; function MyFunction() { var stat=document.getElementById('cbParamVirtual1').value; var del = "Delete"; if(stat==del) { document.getElementById("Mod0DeleteRecord").style.display = 'initial'; } else {document.getElementById("Mod0DeleteRecord").style.display = 'none'; } } document.getElementById('cbParamVirtual1').onchange=MyFunction; </SCRIPT> Quote Link to comment Share on other sites More sharing options...
Question
Mylene
Hi, I need to allow deleting record on Details page only when user is typed "Delete" in a field. How can do that?
Link to comment
Share on other sites
4 answers to this question
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.