Textpattern Forum

You are not logged in. Register | Login | Help

#41 2012-06-13 13:08:20

pafruu
Member
From: New Brunswick, Canada
Registered: 2010-01-14
Posts: 65

Re: adi_contact – Form field validation & spam prevention

jakob wrote:

bq. enhancement: extended “name”+“value” dependency to “restrict” & “number” (for jakob)

Just for info: this makes it possible to do things like “at least one checkbox” is required.

How would I declare in in the code?

here is what I got:

(...)
<tr>
<td colspan="2"><txp:zem_contact_checkbox group="Campselect" label="Kids Kamp" name="Kids Kamp" required="0"/><span class="early">July 3 - 7 </span><br>
<txp:zem_contact_checkbox group="Campselect" label="Family Camp" name="Family Camp" required="0" /><span class="early">July 14 - 29 </span><br>
<txp:zem_contact_checkbox group="Campselect" label="Young Adult Camp" name="Young Adult Camp" required="0"/><span class="early">Aug 3 - 5</span><br>
<txp:zem_contact_checkbox group="Campselect" label="Youth Camp" name="Youth Camp" required="0"/><span class="early">Aug 6 - 11</span></td>
	</tr>
(...)
<tr>
<td colspan="2">
<txp:zem_contact_submit label="Send" />
<txp:adi_contact_checkboxes names="Kids Kamp,Family Camp,Young Adult Camp,Youth Camp" />
<txp:adi_contact_combo names="Kids Kamp,Family Camp,Young Adult Camp,Youth Camp" require="Kids Kamp,Family Camp,Young Adult Camp,Youth Camp"  restrict="min" number="1" message="Please check at least one camp that interests you" />
</td>
</tr>

not sure That i have it listed right as the form goes through no matter what.

Last edited by pafruu (2012-06-13 13:18:28)


I try, and I try, and I try…. and sometimes I achieve

Offline

#42 2012-06-13 13:21:09

pafruu
Member
From: New Brunswick, Canada
Registered: 2010-01-14
Posts: 65

Re: adi_contact – Form field validation & spam prevention

ok I just tried removing the spaces in the names and it worked


I try, and I try, and I try…. and sometimes I achieve

Offline

#43 2012-09-18 15:39:22

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 254
Website

Re: adi_contact – Form field validation & spam prevention

Is possible to activate validation only if field are filled?

checkbox = “I have a code”
Code = xxx
Code repeat = xxx

Offline

#44 2012-09-19 05:38:48

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 923
Website

Re: adi_contact – Form field validation & spam prevention

wornout wrote:

Is possible to activate validation only if field are filled?

checkbox = “I have a code”
Code = xxx
Code repeat = xxx

Hi Edoardo,

I would hope so … if I’ve understood your scenario above, you’d do something like (off the top of my head):

<txp:adi_contact_combo names="codecheckbox" require="code"  />
<txp:adi_contact_validate names="code,coderepeat" type="equal" />

Offline

#45 2013-12-06 03:58:42

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 923
Website

Re: adi_contact – Form field validation & spam prevention

I’m working on a new version of adi_contact which will insert information supplied in a contact form into a database table. If anyone would like to take it for a beta spin, please let me know.

Adi

Offline

#46 2013-12-06 08:05:17

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 440

Re: adi_contact – Form field validation & spam prevention

Hello Adi, you could insert me in you beta test !

Jean-Pol

Offline

#47 2013-12-16 19:57:25

admi
Member
From: BY
Registered: 2007-12-10
Posts: 118
Website

Re: adi_contact – Form field validation & spam prevention

Hello guys!

What is the adi_contact_validate option if phone field cannot start with a “0” or a “1”?

Thanks in advance.

Offline

#48 2013-12-17 10:00:37

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 923
Website

Re: adi_contact – Form field validation & spam prevention

admi wrote:

What is the adi_contact_validate option if phone field cannot start with a “0” or a “1”?

That’ll be something like:

<txp:adi_contact_validate names="phone" type="custom" pattern="^(?!0|1?)" />

… totally untested & completely bodgied up from an answer on Stack Overflow. Regex is a bit too esoteric for this time of night!

Offline

#49 2013-12-17 12:16:05

Gocom
Developer
Registered: 2006-07-14
Posts: 4,476
Website

Re: adi_contact – Form field validation & spam prevention

gomedia wrote:

That’ll be something like:

PHP uses PCRE. That’s close, but it will end in error. In different languages where it would work, it will allow anything as long it does not start with ‘0’ and has zero or one “1”.

A working patter would either be, if you just want to disallow based on first character:

/^[^01]/

Or if you want to validate too:

/^(|[2-9+][0-9+\s\-\(\).]+)$/

Which allows empty value or requires that the first character is 2-9 or +, followed by valid numeric phone number consisting of 0-9, +, whitespace (spaces), -, (, ) and ..


Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

#50 2013-12-17 12:20:31

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 923
Website

Re: adi_contact – Form field validation & spam prevention

Thanks very much!

Offline

Board footer

Powered by FluxBB