Solved

Field Input validation - phone formats

Posted on 2008-06-25
5
937 Views
Last Modified: 2013-12-18
Need help with field input validation for a Phone field that the user wants to be either US or International.
For example if a choice of Domestic is made then the format must validate to 199.999.9999 or if International then no validation is necessary.

How can I input validate the field conditionally?
0
Comment
Question by:Jimphot0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 21872170
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 21872171
0
 

Author Comment

by:Jimphot0
ID: 21873823
I am trying to check that the user formatted properly and if not, return a prompt telling them what format it should be and not save anything until correct. I can do that with our Javascript but I need it to be conditional to the US or Int'l drop-down choice they make.  For example, if dropdown choice is US then YES validate the format to be 199.999.9999 or if ddropdown choice is Int'l then no validation necessary (accept anything).
thanks
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 500 total points
ID: 21874077
I assume it is for Notes client side and not for web.
In the InputTRansalation of the Phone field:
@If(ChoiceField<>"US";@Return(@Success);"");
@If(@Trim(@Length(FieldName))<>10 or (@Trim(@Length(FieldName))<>12;@Return(@Failure("Please enter a vaild phone number");@Success);
phone := @Trim(Field Name);
phonestripped :=@Trim(@Implode(@Explode(@LowerCase(phone); "."); ""));
@If(@Length(phonestripped) = 10; "(" + @Left(phonestripped; 3) + ") " +
@Right(@Left(phonestripped; 6); 3) + "." + @Right(phonestripped; 4); phone)
the above code does auto splits and appends "."

Play with the above code, you can achieve the result.

0
 

Author Closing Comment

by:Jimphot0
ID: 31470630
Thanks for the help -  with  this and some more searching I got there.
 
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question