Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1393 2014-01-27 10:08:37
- dorka
- Member
- Registered: 2012-10-04
- Posts: 90
Re: zem_contact_reborn 4.0.3.20
Hello, Akthuro, thank you for letting me know. Yeah, that is exactly what I did. By the way I realized also that the error is only visible for the user when Txp is in testing and debugging mode. So I let it be.
Btw I have one more question here:
How do I edit the texts in the e-mail and in the error messages? I mean how do I replace e. g. “zem_contact_error_…” with a human words?
Offline
#1394 2014-01-28 07:54:06
- dorka
- Member
- Registered: 2012-10-04
- Posts: 90
Re: zem_contact_reborn 4.0.3.20
Ok, it is zem_contact_lang that does the job.
One more question:
How do I use a value filled in zem_contact_text field as a subject in the e-mail header?
Offline
#1395 2014-01-28 09:52:23
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,311
Re: zem_contact_reborn 4.0.3.20
dorka wrote #278532:
How do I use a value filled in zem_contact_text field as a subject in the e-mail header?
May I simply link you to where this has been asked before?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#1396 2014-01-29 08:30:12
- dorka
- Member
- Registered: 2012-10-04
- Posts: 90
Re: zem_contact_reborn 4.0.3.20
YOU always, Uli ;-)
Tnx
Offline
#1397 2014-01-29 11:38:27
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,311
Re: zem_contact_reborn 4.0.3.20
Yeah, seems I’m dangling everywhere :)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#1398 2014-02-04 00:05:49
Re: zem_contact_reborn 4.0.3.20
After much delay (apologies) I finally got round to uploading the new version of the plugin code for testing to the Github repo. Note this is not a full plugin: it has no documentation yet, as it’s all still in HTML format and I need to reverse-engineer parts of it back into Textile and update it all. Then I need to get better at git-fu to figure the best workflow so I can auto-generate the compiled plugin from code + docs + textpacks when I commit a new tagged version. There’s probably some clever post-commit hook or something I can use, but I need to read up on it / ask a guru.
Anyway, for now, the repo contains just the raw code. If you want to try it out:
- backup your existing plugin / site.
- disable zem_contact_lang.
- copy and paste the code from the github repo over your existing zem_contact_reborn plugin code in the Admin->Plugins panel.
- install the following Textpack in the Admin->Preferences->Language panel:
#@public
zem_contact_checkbox => Checkbox
zem_contact_contact => Contact
zem_contact_email => Email
zem_contact_email_subject => {site} > Inquiry
zem_contact_email_thanks => Thank you, your message has been sent.
zem_contact_field_missing => Required field, “<strong>{field}</strong>” is missing.
zem_contact_form_expired => The form has expired, please try again.
zem_contact_form_used => The form was already submitted, please fill out a new form.
zem_contact_general_inquiry => General inquiry
zem_contact_invalid_email => “<strong>{email}</strong>” is not a valid email address.
zem_contact_invalid_host => “<strong>{host}</strong>” is not a valid email host.
zem_contact_invalid_utf8 => “<strong>{field}</strong>” contains invalid UTF-8 characters.
zem_contact_invalid_value => Invalid value for “<strong>{field}</strong>”, “<strong>{value}</strong>” is not one of the available options.
zem_contact_mail_sorry => Sorry, unable to send email.
zem_contact_maxval_warning => “<strong>{field}</strong>” must not exceed {value}.
zem_contact_max_warning => “<strong>{field}</strong>” must not contain more than {value} characters.
zem_contact_message => Message
zem_contact_minval_warning => “<strong>{field}</strong>” must be at least {value}.
zem_contact_min_warning => “<strong>{field}</strong>” must contain at least {value} characters.
zem_contact_name => Name
zem_contact_option => Option
zem_contact_pattern_warning => “<strong>{field}</strong>” does not match the pattern {value}.
zem_contact_radio => Radio
zem_contact_recipient => Recipient
zem_contact_refresh => Follow this link if the page does not refresh automatically.
zem_contact_secret => Secret
zem_contact_send => Send
zem_contact_send_article => Send article
zem_contact_spam => We do not accept spam, thank you!
zem_contact_text => Text
zem_contact_to_missing => “<strong>To</strong>” email address is missing.
For the most part, it’s a drop-in replacement for v4.0.3.20 but it has been significantly refactored behind the scenes combining Ruud’s latest edits with my own to allow other plugins to have more control over the mail process.
From the tag side, you have a whole raft of HTML 5 input attributes available. These include:
- accesskey
- autocomplete
- autofocus
- class
- dir
- disabled
- form (auto-filled in on your behalf by default)
- hidden
- id
- lang
- list
- max
- min
- pattern
- placeholder
- readonly
- spellcheck
- step
- style
- tabindex
- title
- translate
- type (for
<txp:zem_contact_text>
only) - wrap (for
<txp:zem_contact_textarea>
only)
In addition, the <txp:zem_contact>
tag accepts these additional attributes:
body_form
so you can define body content in a Form.expire
so you can set how long, in seconds, the form expires (default: 600)required
which allows you to globally toggle on or off therequired
attribute for all contained ZCR tags. By default they’re all set to be ‘required’ but there are times you may want to have a form where most of the fields are optional. In the old plugin you had to explicitly turn off therequired
attribute for every tag, but now you can just turn it off once in the main ZCR container tag and then switch it on only for the tags you need.
There’s also a new <txp:zem_contact_option>
tag so you can define custom select lists inside your <txp:zem_contact_select>
, and a conditional tag <txp:zem_contact_if>
which accepts name/label/value attributes to compare the given attribute name or label against the given value. Haven’t fully tested that yet, reports or improvements welcome.
For programmers wanting to try out the new zemcontact.deliver
callback, the code is fairly well documented. Lots of fun can be had in plugins by either:
- altering the
$payload
passed to your plugin, such as adding Multi-part MIME headers for HTML emails. - returning
true
to allow ZCR to continue mailing after your plugin completes. - returning
null
to skip ZCR’s mailing and issue ‘success’. - returning
false
to halt zem_contact’s mailing (i.e. your plugin handles mailing) and trigger a ‘fail’. - exit from inside your plugin after doing your code, but note this will not do any ZCR redirect that may be in place.
Don’t rely on these return codes to be gospel just yet (EDIT: in fact, see this post for updates) as I’m not totally happy with this rudimentary signalling mechanism. For starters, it doesn’t distinguish between a primary send and copysender so your plugin will get called twice if copysender
is on and you won’t know which is which. I’ll probably add a ‘step’ to the callback so you can choose to isolate one or the other, or omit the step and do both.
I’ve not figured out a way to incorporate Hilary’s Modernizr fallback mechanism yet because it was implemented as a separate tag which you manually add to the page (usually before the closing </body>
tag). Thus it is ‘separate’ from the regular flow of the form generation so the plugin doesn’t really have any place to raise a callback to help out. Thoughts welcome. Maybe this JS tag can just be a companion plugin that Hilary maintains, which people can use if they wish to employ Modernizr fallback.
Anyway, enough rambling. Please explore and report anything you find to me directly by email, or here, or on the issue tracker. When the thing is fully tested and we have some usage reports in, I’ll open a new thread, get the docs updated and release it properly.
Happy contact forming.
Last edited by Bloke (2014-07-09 09:08:09)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#1399 2014-02-05 17:50:54
Re: zem_contact_reborn 4.0.3.20
Nice one bruce.
Offline
#1400 2014-02-11 17:42:07
Re: zem_contact_reborn 4.0.3.20
I’ve just done a very very quick new Modernizr fallback companion plugin for zem, same code as I had there which I must expand on and clean up but it works very well especially for type=date which is poorly supported, so there’s a date picker fallback, you can download it here
Tested it with Stefs new edited version and all looks good! Stef so happy to see this released it’s just a great step for anyone interested in using Txp to have html5 web forms like this, I think it will be huge!! :)
…………………
I <3 txp
…………………
Offline
#1401 2014-02-19 11:15:57
- dana
- New Member
- Registered: 2014-02-19
- Posts: 6
Re: zem_contact_reborn 4.0.3.20
Hello, I’m new to Textpattern but so far I’m loving it while testing. :)
I’m trying to implement a contact form, but I’m having some difficulty. I’m using TXP 4.5.5 and the newest zem_contact_reborn from the beginning of this thread. Installation is fine, no errors whatsoever.
When I try to test my form, it’s not working – ie. if I fill every required field and send it, the page refreshes but I get no email. When I purposefully leave out some required fields and send, no error is displayed.
I’ve checked with Firebug if there are any JS errors but everything seems fine.
I’m using Zurb Foundation framework, maybe it has some effect on it? Here is my form code (substituted the email with placeholder one, don’t want to advertise here :)):
<txp:zem_contact to="email@email.com" subject_form="subject">
<div class="row">
<div class="six columns"><txp:zem_contact_text label="Name" required="1" /></div>
<div class="six columns"><txp:zem_contact_email label="Email" required="1" /></div>
</div>
<div class="row">
<div class="six columns"><txp:zem_contact_select label="Subject" list=",option 1,option 2,option 3,option 4,option 5" required="1" /></div>
<div class="six columns"><txp:zem_contact_select label="Budget" list=",1,2,3,4" required="1" /></div>
</div>
<txp:zem_contact_textarea label="Your message" required="1" />
<txp:zem_contact_submit label="Send" />
</txp:zem_contact>
Does it matter what status my textpattern is (i.e. testing, debugging,…)?
Thank you in advance!
Offline
#1402 2014-02-19 13:54:24
- dorka
- Member
- Registered: 2012-10-04
- Posts: 90
Re: zem_contact_reborn 4.0.3.20
Did you actuvate your plug-in?
Offline
#1403 2014-02-19 14:00:07
- dana
- New Member
- Registered: 2014-02-19
- Posts: 6
Re: zem_contact_reborn 4.0.3.20
Yes, it is activated. Otherwise it wouldn’t display in the frontend and would give me errors.
Offline
#1404 2014-02-19 14:22:10
Re: zem_contact_reborn 4.0.3.20
Have you a form called “Subject” ? because in your code:
<txp:zem_contact to="email@email.com" subject_form="subject">
Offline