Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-21 19:25:20

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

mem_form - Generic HTTP form processing

Edit: 2010-10-03

Please go to http://bitbucket.org/Manfre/txp-plugins if you…
  • are having a problem and want to report a bug
  • would like to request a new feature
  • are looking for documentation
  • are looking for the plugin code
  • are looking to download the latest ready to install plugin file

I do not regularly follow this thread anymore. Any problems or questions posted here will most likely only get answered by other forum members.

Original post

This plugin will allow other plugin developers to easily add HTTP form processing to their plugin. The plugin help provides information for developers and users.

Feature List:

  • Required fields
  • Min and Max field length requirements
  • nonce support
  • Server-side variable pass through
  • Spam filter support
  • Callbacks
  • Regex pattern validation
  • File uploads
  • Configurable mem_form_mail content-types

Latest Version: 0.5.4

Plugin Download

Last edited by Manfre (2010-10-03 16:18:30)

Offline

#2 2007-12-21 22:30:02

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: mem_form - Generic HTTP form processing

Hmm… code looks very familiar ;)

Offline

#3 2007-12-21 23:09:10

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: mem_form - Generic HTTP form processing

Yup. It’s based upon zem_contact_reborn. A client specifically asked me to add the form functionality from that plugin in to mem_moderation. The first time I typed the post above mentioned that, but the site ate the post.

Offline

#4 2007-12-22 02:18:35

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: mem_form - Generic HTTP form processing

Very nice! I haven’t had a chance to play around with it yet, but sounds like something that would cut development time on several plugins.

Offline

#5 2007-12-24 21:59:43

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: mem_form - Generic HTTP form processing

Just thought of a new plugin based on this. Should be simple but a form to db plugin. Let admins create new tables in the backend to store data from a form.

Offline

#6 2007-12-24 22:07:18

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: mem_form - Generic HTTP form processing

Cool. I’m currently adding the tag, mem_form_file so I can migrate mem_moderation_image.

Offline

#7 2007-12-25 00:53:05

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: mem_form - Generic HTTP form processing

Typolight has something like this:

This will give me a chance to develop on my jquery skills as well.

Offline

#8 2007-12-26 18:59:03

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: mem_form - Generic HTTP form processing

Let me know if there are any mem_form features that would assist you towards completing that plugin.

Offline

#9 2008-02-26 18:03:28

kelsta
New Member
Registered: 2006-05-31
Posts: 7

Re: mem_form - Generic HTTP form processing

Hi, I’m trying to put together a slightly modified registration form which collects some addtional data for equal opportunities compliance purposes which needs inserting into a separate table.

I’d like to be able to populate some select and checkbox fields automatically by selecting values from the database. However because any PHP in my form isn’t processed until the 2nd pass, if I do something like

<txp:php> foreach (thingFromDatabase as thing) { echo “<txp:mem_form_checkbox attrs />”; }
</txp:php>

the checkbox gets created in the output HTML, but isn’t processed by the plugin to ‘save’ the values from the posted form. Hence they aren’t available in $mem_form_values[].

Does anyone know if there is any magic that can resolve this, or might I either have to make the fields static, or access the $_POST variables directly?

Offline

#10 2008-02-26 18:10:32

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: mem_form - Generic HTTP form processing

Don’t use inlined php. Instead, create a plugin and have it hook in to submit and default events as described in the plugin help. You are then left with the option of hooking the display event to add the checkboxes, or you can use <txp:mem_form_check …> in the form.

Offline

#11 2008-02-26 19:22:04

kelsta
New Member
Registered: 2006-05-31
Posts: 7

Re: mem_form - Generic HTTP form processing

Thanks Michael,

hooking into the submit callback is obviously where I should be acting on the data. Cheers for pointing me in the right direction, I think I’ve got a handle on that now.

Am I right in thinking that with the display event I can add HTML to the form at either the beginning or the end, based on the $pre value? Is there any way of replacing a tag on a page from within a callback in Texttpattern? Ie. can I put something in the middle of the form and have the callback replace that with something else?

Also, am I right that using the callback to programmatically add fields, I still can’t add <txp:mem_form…> tags and pull out the data from the $mem_form_values[] array? As they’re not procecced I’ll still have to work with $_POST to get the values from the extra fields I add? That seems to be the result I get if I add mem_form tags from my display callback.

Cheers for your help,
Alex

Offline

#12 2008-02-26 19:29:16

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: mem_form - Generic HTTP form processing

Am I right in thinking that with the display event I can add HTML to the form at either the beginning or the end, based on the $pre value? Is there any way of replacing a tag on a page from within a callback in Texttpattern? Ie. can I put something in the middle of the form and have the callback replace that with something else?

By making plugin & function ;) tags are always replaced with functions (or custom parser with plugin).

$_POST to get the values from the extra fields I add? That seems to be the result I get if I add mem_form tags from my display callback.

With plugin you can get them easily, in example with ps('name_of_the_field'); or extract(psa('name1','name2')); or by just calling the function as Manfre said.

Offline

Board footer

Powered by FluxBB