[Pro] Validate for

When using the Validate form action - type numeric only

I want to be able to input ***** (5 digits area code or mobile) followed by the remaining ****** (6digits)

EG: 01234 567891

How do I do this?

Min is set to [none]
Max is set to [none]

Worm


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

2 fields?

Or am I misunderstanding your needs?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

1 field 00000 000000

With this format: So say 01445 123456

thanks

Dave


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The tools provided by the standard Validate Action are too simple for this kind of format. What you might want to do is something like this (through the Item / Extended dialog):

onchange="if(!!this.value && !this.value.match(
	/dddddsdddddd/))
	alert('Your error message here')"

Note that this must be all on one line, I broke it up here because I didn’t want FreewayTalk to make salad out of it.

Walter

On Oct 5, 2012, at 11:15 AM, Mr worm wrote:

1 field 00000 000000

With this format: So say 01445 123456

thanks

Dave


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Walt

So is the Extended dialog

name: onchange

value:

"if(!!this.value && !this.value.match(
    /dddddsdddddd/))
    alert('Your error message here')"

many thanks Worm


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes, just put all that in one line. There’s an even neater way to write it using grouping:

match(/d{5,}sd{7,}/)

The number, comma pair in the braces following the d placeholder means “exactly this many” rather than typing out a single match placeholder for each digit. If there was a second number in the braces, it would mean “between this many and that many, inclusive”.

Here’s a working example. The error message will be funny for long-time Action authors, nobody else will get it.

http://scripty.walterdavisstudio.com/phone-validate.html

Note that because we’re using onchange here to trigger the checking, the visitor will have to enter something, then click or tab somewhere else before the error will be checked. This means that in a simple form like this, where there’s only one field and a submit button, the validation might never occur. The Action does the right thing – it hooks into the form’s onsubmit handler method, and blocks form submission if there are any errors in the form. So this is a partial solution at best, and will only help you if the form has more fields that the visitor really must tab or click into. Also, it lets an empty field pass as written. Remove the !!this.value && part to make it sensitive to a missing value.

Walter

On Oct 5, 2012, at 11:31 AM, Mr worm wrote:

Thanks Walt

So is the Extended dialog

name: onchange

value:

"if(!!this.value && !this.value.match(
   /dddddsdddddd/))
   alert('Your error message here')"

many thanks Worm


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks you Walt!!!

Thats perfect

Worm


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options