Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-02-11 01:58:45

velograph
New Member
From: Oregon
Registered: 2007-03-25
Posts: 9

Re: mem_simple_form

I don’t have too much experience working with plugins, so forgive me if this is a dumb question. I’ve been using zem_contact and a few others on my sites with no need to alter/add/change a thing. This is new territory for me.

Would I be adding my javascript into the form itself? Say right in <txp:mem_form_submit javascript entered here /> ?

I was thinking the simplest way of acheiving what I want would be to have an onclick event that sends the user one of two places.

Or would I need to add that into the plugin where the submit button is defined? This seems rather unlikely, but then again, I’m fairly new.

I’m posting this javascript question here because it deals with adding it to a plugin. I hope that’s not taboo.

Offline

#14 2009-02-11 02:25:14

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

Re: mem_simple_form

Jason, you can use the newly added success_form. In the success_form, you could use <txp:mem_simple_ps name="mem_form_submit" /> to set a javascript variable.

Offline

#15 2009-02-21 01:07:36

cpk
Member
Registered: 2005-08-07
Posts: 62

Re: mem_simple_form

I would like to redirect the user after the form has been submitted. It appears that I need to use success_form to accomplish this, however, I have attempted virtually every combination of tag syntax and am unable to get it to work under TxP 4.0.8.

The following tag syntax is the only one that does not throw tag errors on page load:

<txp:mem_simple_form table="txp_test_users" name="success_form_test_success" />

There is one exception. I am required to identify a table. I assume that I am supposed to identify the txp_form table to properly find the form I want to have displayed after the HTML form is submitted. Unfortunately, I get an error stating that “no data was submitted with form”.

If I remove the success form tag, it works as expected and properly writes to the database. I think I must have the success_form syntax wrong but every other combination seems to throw a tag error. I have even tried variations using the mem_form tag since there are examples of that in the plugin description and mem_simple_form relies on that plugin to function.

Can someone please post an example of what the complete success tag should look like so that I may correct mine or I can compare to see if I should be looking at some other cause for the failure of my form.

Thx,

cpk

Offline

#16 2009-02-26 02:03:32

cpk
Member
Registered: 2005-08-07
Posts: 62

Re: mem_simple_form

Solved my own problem. Now it seems quite obvious what I did wrong. For others who may have also had problems, here is the solution: I thought the success_form was invoked by using the name attribute as I posted above. The following is an example of the proper way to redirect to a success_form after your mem_simple_form is submitted.

<txp:mem_simple_form table="txp_test_users" id_field="user_id" id_insert="0" success_form="mem_simple_test_success" >

cpk

Offline

#17 2009-02-26 02:13:53

cpk
Member
Registered: 2005-08-07
Posts: 62

Re: mem_simple_form

So, I now have this working to take user input, post it to a specific DB table and redirect the user to the downloadable content they are seeking in exchange for their email address.

However, I would like the user to continue to have access to the downloadable content during the remainder of the browser session without the need to re-enter their information to gain access. Even better would be the option to save info to a cookie that would provide users who have already provided their information the ability to access the downloads during subsequent browser sessions.

Does anyone have any recommendations to accomplishing this with mem_simple_form with or without additional plugins or will this kind of feature need to be custom coded?

Thanks,

cpk

Offline

#18 2009-02-26 08:13:38

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

Re: mem_simple_form

You could use chs_cookie to write a cookie on reaching the success form, and check for this cookie before presenting the form.


TXP Builders – finely-crafted code, design and txp

Offline

#19 2009-02-27 03:53:52

cpk
Member
Registered: 2005-08-07
Posts: 62

Re: mem_simple_form

Jakob,

This looks like what I am looking for but I can’t test it since it seems that his server is not allowing public access for download. Any other sources for chs_cookie download?

Thanks,

cpk

Offline

#20 2009-02-27 04:11:22

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: mem_simple_form

Offline

#21 2009-03-03 20:40:11

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: mem_simple_form

Upgrading to the latest versions of mem_form and mem_simple_form resolved all the problems I was experiencing earlier. Thank you!

Q: 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?

A: Annotate=1

I added Annotate="1" like so: <txp:mem_simple_form table="textpattern" id_field="ID" id_insert="0" Annotate="1"> No errors. The article posts perfectly, but commenting remains closed.

What did I do wrong? What is the correct path? I’m thankful for your help!

Offline

#22 2009-03-09 19:24:06

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: mem_simple_form

I’ve probably posted enough questions here to give Mr. Manfre brain cancer. So I’ll post a solution.

The correct way to enable comments on articles submitted to the textpattern table by mem_simple_form is this:

<txp:mem_form_secret name="int_Annotate" value="1" />

Offline

#23 2009-04-15 23:03:51

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: mem_simple_form

I’m trying to create a two-step form using the success-form attribute:

  1. New category: Create a new category.
  2. Step-2: Add a new article to the same category, with the category-name preselected using a mem_form_secret field.
  3. Step-3: Success.

I’m almost there:

  1. I’ve succeeded in getting mem_simple_form to create a new category— even though I have no idea how to generate Textpattern-like category names from the titles, or how to rebuild the category tree to put stuff in the right order. Right now I’m using mem_simple_form’s randuid attribute to generate information in the name, lft, and rgt fields. I’ve verified that this form posts to the database, and the new category is recognized and operational in Textpattern.
  2. The “new category” form includes a success form attribute: success_form="step-2". This form includes another mem_simple_form to add an article to the new category. I’m using mem_form_secret in tandem with mem_simple_ps to inlcude the previous form’s input as a category. I tested it in a hidden field and I can verify that the information form the previous form is successfully transfered to the appropriate field using mem_simple_ps.
  3. The “step-2” form includes a success form attribute: success_form="step-3". This would be the form that says “You’re finished— article posted!” —but that’s where the idea fails. When “step-2” is submitted, the I never get to see my beautiful “step-3” success form; it just back to the “new category” form above. It also fails to post the article. But it doesn’t throw up any errors.

Any ideas how I could fix this? Am I straining beyond the capability of this plugin? If so, is there some other method I could use to get this working?

Thanks!

Offline

#24 2009-04-16 02:19:49

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

Re: mem_simple_form

Do all of the steps use the same url? If so, that might explain why the first step is being loaded instead of your third step.

Offline

Board footer

Powered by FluxBB