Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Validation script that looks for a specific number

We have a form that in one of it's field you can enter phone number.

We want a script that checks that the first digit entered is 0.If another digit is being entered a pop up message will appear that the digit entered is not correct.

What is the script in order to achieve this ?
3 Replies

Avatar

Level 5
Drop this FormCalc code in 'exit' event of the field.

var FirstDig

FirstDig = Left($.rawValue, 1)

if (FirstDig <> 0) then

xfa.host.messageBox("Please check the number. Phone number has to start with '0'.")

endif



Good luck,

SekharN.

Avatar

Level 2

Fantastic, I was trying to force users to only insert urls from my domain and this worked a treat!

Cheers mate...

var

FirstDig

FirstDig

= Left($.rawValue, 20)

if

(FirstDig <> "http://mydomain.co.uk") then

xfa.host.messageBox("Please use http://mydomain.co.uk, files are more secure there!")

$.rawValue

= null

endif