Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-05-13 21:07:36

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

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

This is a great plug-in. It really does extend the use of zemcr.

I am struggling with some check boxes though. The snippet below is intended to ensure that the user completes at least one checkbox indicating an interest in a particular qualification or qualifications. The error message appears whether 0, 1, 2 or all 3 boxes are checked. I am using version 0.2.

<div><txp:zem_contact_checkbox label="CEng" name="ceng" break="" required="0" /></div>
<div><txp:zem_contact_checkbox label="IEng" name="ieng" break="" required="0" /></div>
<div><txp:zem_contact_checkbox label="EngTech" name="engtech" break="" required="0" /></div>
<txp:adi_contact_combo name="ceng,ieng,engtech" checkbox="1" restrict="min" number="1" message="Please check at least one Professional Registration that interests you" />

Any idea where I am messing up?

Joe

Offline

#14 2009-05-14 00:23:27

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

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

joebaich wrote:

This is a great plug-in. It really does extend the use of zemcr.

Glad you find it useful.

I am struggling with some check boxes though. Any idea where I am messing up?

Try using names= rather than name=.

Cheers,

Adi

Last edited by gomedia (2009-05-14 00:24:26)

Offline

#15 2009-05-14 02:59:17

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

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

gomedia wrote:

Try using names= rather than name=.

Adi, Very many thanks, how could I be so blind to that!

Offline

#16 2009-05-14 09:45:32

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

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

joebaich wrote:

Adi, Very many thanks, how could I be so blind to that!

That’s OK. It happens to me all the time. It was only when I blindly pasted your code into my test bed that the helpful Textpattern provided the answer!

Offline

#17 2009-05-14 13:09:31

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

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

Adi,

You know, in this case, the profound annoyance I felt with myself for missing the names vs name error was surpassed by the absolute delight I experienced when the form began to behave as it should. It is a mini poll aimed at members of an Institute and needed to include verification that the respondent is a bone fide member. The error checking and verification that your plug-in provides makes it straightforward to do with ZCR. Very many thanks again.

Joe

Offline

#18 2009-06-17 02:48:46

kevinpotts
Member
From: Ghost Coast
Registered: 2004-12-07
Posts: 370

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

Adi, this is another amazing plugin. I read through the documentation, and I have a quick question. Can you determine if two fields are the same value? For instance, in a contact form, having a field for an e-mail address, and then a second field to type in the e-mail address again, and then somehow verifying they’re the same value?


Kevin
(graphicpush)

Offline

#19 2009-06-17 03:45:49

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

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

Hi Kevin.

kevinpotts wrote:

Can you determine if two fields are the same value?

Sounds feasible – I’ll look into it.

Offline

#20 2009-06-19 10:29:03

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 215
Website

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

hello, seams to me that some break; are missing in adi_contact_validate :

case 'phone':
                            $ok &= preg_match("/^[0-9x\ \+\-\(\)\.,]*$/i",$field_value);
                        case 'url':
                            $ok &= preg_match("/^(?:http:\/\/)?(?:[\w-]+\.)+[a-z]{2,6}$/i",$field_value);
                        case 'custom':
                            if ($pattern)
                                $ok &= preg_match($pattern,$field_value);

Took some time to figure out.
regards

Last edited by planeth (2009-06-19 10:32:52)

Offline

#21 2009-06-19 10:39:54

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

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

planeth wrote:

hello, seams to me that some break; are missing in adi_contact_validate :

You’re quite right! Thanks for pointing out my not-so-deliberate mistake. Strangely enough, I spotted it last night when looking into Kevin Potts’ request. It’ll be fixed in the next update.

Offline

#22 2009-06-19 10:55:19

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 215
Website

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

You’re welcome !
I’ll check for updates.

Offline

#23 2010-05-27 18:22:12

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

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

This looks like a very useful plugin, but unfortunately I’ve had trouble getting it to work. There seems to be a problem with this plugin’s conditional field requirement feature in cases where one of the fields is a checkbox and the other is not.

The form I’m working on has a checkbox where the user indicates their preference for getting a sales call. If they check the box, a bit of JavaScript reveals and enables the phone number field. I want the phone number field to be required only if the user checked the box indicating that calls are okay. Here’s the code I’m using for that part of the form:

<ul id="phone-fields">
  <li><txp:zem_contact_checkbox name="prospect-phonepref" label="I want a sales associate to call me." required="0" break="" /></li>
  <li id="optional-phone"><txp:zem_contact_text name="prospect-phonenum" label="Phone Number" required="0" min="7" max="30" break="" /></li>
</ul>

<txp:zem_contact_submit>Request Free Trial</txp:zem_contact_submit>

<txp:adi_contact_combo names="prospect-phonepref" checkbox="1" require="prospect-phonenum" message="If you want us to call you, please provide your phone number." />

The form presents the error message regardless of whether the checkbox is checked. Unless I’ve misunderstood the plugin’s documentation, this should work… right?

Offline

#24 2010-05-27 23:19:07

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

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

Logoleptic wrote:

… There seems to be a problem with this plugin’s conditional field requirement feature in cases where one of the fields is a checkbox and the other is not.

Hi Adam, I’ll look into it.

Offline

Board footer

Powered by FluxBB