wgalliance Posted June 3, 2016 Report Share Posted June 3, 2016 I have my login page deployed which is working fine. the User ID is a text field that is a 9 digit number, often seen by the user as XX-XXXXXXX. In the input for the login screen, if someone enters the hyphen, I'd like to add script to remove it so it happens in the background. This is what I added so far that is not working: <SCRIPT LANGUAGE="JavaScript"> function nophyphen() { var a = document.getElementById("xip_EIN").value; a = a.replace(/-/g, ""); } document.getElementById("caspioform").onchange=nohyphen; </script> Quote Link to comment Share on other sites More sharing options...
kRv Posted June 3, 2016 Report Share Posted June 3, 2016 Hello wgalliance, HTML element "form" doesn't have "onchange" event. Also after change variable "a" you didn't set it back to "value" property of input element. Please add this script to footer of authentication which you use. <script type="text/javascript"> function nophyphen() { var ctrl = document.getElementById("xip_UserId"); if (ctrl) { ctrl.value = ctrl.value.replace(/-/g, ""); } } var xip = document.getElementById("xip_UserId"); if (xip) { xip.onchange = nophyphen }; </script> Please pay your attention, that you need to change "xip_UserId" to correct name of your field. You can see example below https://c2ebv261.caspio.com/dp.asp?AppKey=B4D84000c0990f53c7f4496d8943 Thanks wgalliance 1 Quote Link to comment Share on other sites More sharing options...
wgalliance Posted June 13, 2016 Author Report Share Posted June 13, 2016 Thank you! This worked perfectly! 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.