Jump to content
Sign in to follow this  
wgalliance

Java To Remove Hyphen In Login Page

Recommended Posts

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>

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...