Textpattern CMS support forum
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.
In an effort to empower more Textpattern users, I have created the plugin mem_simple_form. This plugin will allow a site owner to create a form that is able to accept an arbitrary number of fields and store them in to an existing database table. Basic processing can be done to the fields after the form is submitted.
mem_simple_form version 0.3
This tag will output an HTML form. The HTML form field names must follow the pattern “type_name”, where type is a value from the below type list. The database table’s field name must match name exactly.
- now – MySQL “NOW” function. Use with mem_form_secret or mem_form_hidden.
- password – MySQL “PASSWORD” function
- oldpassword – MySQL “OLD_PASSWORD()” function
- md5 – MySQL “MD5” function
- sha1 – MySQL “SHA1” function
- rand – MySQL “RAND” function. Use with mem_form_secret or mem_form_hidden.
- textile – Textile parse field
- nl2br – Convert newlines to br tags
- randuid – Generate a random unique id (md5 hash). Use with mem_form_secret or mem_form_hidden.
- lower – Convert to lower case
- upper – Convert to upper case
- string – No processing
- int – Field contains a numeric value
- table string Name of the table to insert data on a successful form submission.
- id_field string If specified, this is the name of the table field that is a PRIMARY KEY or UNIQUE INDEX. This allows updates if a record with a matching ID already exists.
- id_insert int If “1”, the ID field will be inserted/updated. Otherwise, the field is assumed to be auto generated by the database.
- ignore_fields string A comma separated string of field names (including prefixes) that will not be written to the table. These are handy for ToS checkboxes and CAPTCHAs.
- form string Name of form that contains the mem_simple_form form tags.
- success_form string Name of the form that will be shown after a successful post.
Conditional tag that checks to see if a HTML field was posted, or if it has a specific value.
- name string HTML field name posted with the form.
- equal string Value to compare against the value of name. If not specified, tag checks to see if form posted variable HTML field name.
This tag will output the value of the posted HTML form field.
- name string HTML field name posted with the form.
This example will create a form that will allow a user to add a new “Page” to Textpattern and the contents of the textarea will be parsed for Textile tags prior to saving.
<txp:mem_simple_form table="txp_page" id_field="name" id_insert="0"> <txp:mem_form_text name="string_name" label="Title" required="1" /> <br /> <txp:mem_form_textarea name="textile_user_html" label="Template" /> <br /> <txp:mem_form_submit /> </txp:mem_simple_form>
Last edited by Manfre (2010-10-03 16:19:40)
- From: Lenzing, Austria
- Registered: 2005-06-06
- Posts: 3,265
1. mem_simple_form uses mem_form, which was originally a modified/abstracted version of the form processing logic in ZCR. It uses a nonce to ensure that a form is used only once for each empty form load. Plugin developers can also create spam filters for the form in a fashion similar to ZCR. The next release (in SVN and testing) will have the ability to specify HTML fields that will not be saved to the database, which will allow for captcha’s and honeypot fields.
Conclusion from initial test: Wonderful! Thanks!
Two quick questions:
- How can I get comments to be on by default for articles submitted through
simple_form? Comments are allowed by default in my admin prefs. Is there a field in the textpattern table I can target for this?
- What’s the right way to deal with body text for an article in the textpattern table? I can get input to go into either
body_html, but not both.
- Is there another way to add a category1 other than the
mem_form_select_categorytag? I can send a string to the
category1field using other input methods, but it doesn’t connect.
Thank you again!
Thank you, sir!
What’s the correct version of the plugin to use— v0.1 or v0.2?
Also, what fields from the
textpattern table must be informed by the plugin, my use of input fields, in order to create a record successfully?
Last edited by johnstephens (2009-01-29 19:11:09)
- From: Oregon
- Registered: 2007-03-25
- Posts: 9
I’m using this plugin to create a registration form and it’s awesome! I’m very thankful for your work on this.
I’m wondering if it’s possible to have two submit buttons?
Reason being that we’re having a regional get together and we’re wanting to let people sign up and pay now, or sign up and pay when they arrive. I’m using the mem_simple_form to collect the data, and then send it back to the page in a table using smd_query so that people can see who will be attending. Is it possible to send the info to my database and redirect the user to a paypal page that I’m creating? And then have the other button give a simple thanks message like “Thanks! See you there!”
Is this a bit out of the realm of this plugin? Or am I missing something? I’ve been poring through your documentation for a couple days now and my eyes are slightly crossed.
Either way, thanks for the awesome plugin.