Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2011-03-25 00:48:25

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,303
Website

Re: adi_contact – Form field validation, spam prevention & more

Version 0.4 now available:

  • change: new adi_contact_checkboxes tag (adi_contact_combo ‘checkbox’ attribute withdrawn)
  • enhancement: adi_contact_combo if “value” then “required” (for sacripant)
  • fix: internationalised ‘Yes’ & ‘No’ in checkboxes (thanks sacripant)
  • fix: no more duplicate javascript insertion
  • class action: ‘adi_contact_combo_error’, ‘adi_contact_validate_error’, ‘adi_contact_spam_error’ (for net-carver)
  • new adi_contact_validate type ‘base64’ (for net-carver)
  • javascript code rewrite (& bug fixes: <select>, multiple forms)

An important thing to be concerned with here, is when you upgrade you’ll need to list your checkboxes “of interest” using the <txp:adi_contact_checkboxes /> tag rather than with the checkbox="1" attribute. There’s an unsubtle error message to tell you about this if you don’t! This change will make checkbox validation bullet proof – finally … I hope.

Last edited by gomedia (2011-03-25 00:49:14)

Offline

#38 2011-03-25 15:03:45

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: adi_contact – Form field validation, spam prevention & more

Add conditions with a drop down list (select).

<txp:zem_contact>
  <txp:zem_contact_select name="region" label="Where do you live?"
    list=",UK,France,Germany,Other" />
  <txp:zem_contact_text name="region_other" label="If Other, then where?" required="0" />
  <txp:adi_contact_combo names="region" value="other" require="region_other"
    message="Where else do you live?" />
</txp:zem_contact>

Perfect, a very nice update.
Thanks Adi

Offline

#39 2011-09-06 01:05:13

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,303
Website

Re: adi_contact – Form field validation, spam prevention & more

Version 0.5 ready for action.

  • fixed: javascript doesn’t find contact <form> if zcr input & error forms are separate (thanks jakob)
  • fixed: error message if no fields filled in when using “value” attribute
  • fixed: errors in checkbox processing (thanks jakob)
  • enhancement: extended “name”+“value” dependency to “restrict” & “number” (for jakob)

Thanks goes to jakob for the comprehensive diagnostics, his patience and the testing of this version.

Offline

#40 2011-09-06 07:24:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,088
Website

Re: adi_contact – Form field validation, spam prevention & more

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.


TXP Builders – finely-crafted code, design and txp

Offline

#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 & more

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 & more

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: 256
Website

Re: adi_contact – Form field validation, spam prevention & more

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: 1,303
Website

Re: adi_contact – Form field validation, spam prevention & more

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: 1,303
Website

Re: adi_contact – Form field validation, spam prevention & more

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: 752
Website

Re: adi_contact – Form field validation, spam prevention & more

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: 145
Website

Re: adi_contact – Form field validation, spam prevention & more

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: 1,303
Website

Re: adi_contact – Form field validation, spam prevention & more

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

Board footer

Powered by FluxBB