Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Input field format validation using KeyPress event

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Input field format validation using KeyPress event
 Login/Join
 
Gold member
posted
In the KeyPress code below, the javascript validates the date format as it is entered into the input field. As each character is entered, the format is inspected and a decision is made whether or not the proper format is complete - if yes stop formatting, if not, continue formatting. Actual input validation and formatting of the input is performed by the formatdate function.

function OnedtInputField_KeyPress ( )  {
 var x = document.activeElement.value.match(/\//g);
 var flag = 0;
 if( x && x.length == 2 )
 {
 flag = 1;
 }
 if( !flag )
 {
 document.activeElement.value =
 formatDate(document.activeElement.value);
 }
 }
 


This works fine.
Now I need javascript code to do the same type of inspection for social security numbers and telephone numbers. I'm thinking this is an exercise in regular expressions. For social security numbers it should be rather simple, once I figure it out. But for telephone numbers it may be a slight bit more complex.

How anyone used or written such code before and can share it here? I'm open to all and any suggestions.

Thanks,
George


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 70 | Registered: April 27, 2012Report This Post
Expert
posted Hide Post
I'm sure a JavaScript-centric forum will be of more assistance, such as StackOverflow. Meanwhile, a quick Google search came up with this jQuery example: Validate phone numbers using jQuery.

And then, in HTML 5, there are new input types: HTML5 Forms: How To Use The New Email, URL, and Telephone Input Types.

I'm sure there's much more out there...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Thanks Francis.

This issue across various screens throughout the application and there's no current use of jQuery . To attempt using jQuery could inject other issues risking downtime to users.

With regards to HTML5, the same explanation applies. I wouldn't have time to update all the forms and later troubleshoot any new issues HTML5 would inject.

I'm now thinking this is just a matter of placing the appropriate regular expression in match() to inspect phone numbers or SSNs..

I'll keep looking.

Thanks for your help.


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 70 | Registered: April 27, 2012Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Input field format validation using KeyPress event

Copyright © 1996-2020 Information Builders