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
Solved

Field Input validation - phone formats

Posted on 2008-06-25
5
933 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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