You are not logged in.
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
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
I’m trying to create a two-step form using the success-form attribute:
mem_form_secret field.I’m almost there:
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.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.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
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
Manfre wrote:
Do all of the steps use the same url?
Yes— Step one is at example.dev/section/
When I click submit, the success-form with Step-2 loads, appending a string to the url like so:
example.dev/my-section/#mem24251a6b5ac2e0880d55a5affabcd39a
When I click submit on Step-2, a new string appears, but no success-form:
example.dev/my-section/#memcc4d59f633db8d9ca9df8cb1f54a5522
If so, that might explain why the first step is being loaded instead of your third step.
Is there a way to make the success-form load at a different url? If so, that would probably solve the problem.
Thank you again!
Offline
Is there a way to make the success-form load at a different url? If so, that would probably solve the problem.
No, i’m just trying to get a handle of how you are using the forms. You should have each form set a hidden field that identifies which form should be rendered. Each form should be guarded by a conditional tag that checks for the appropriate hidden field to prevent the other 2 from loading.
Offline
Manfre wrote:
You should have each form set a hidden field that identifies which form should be rendered. Each form should be guarded by a conditional tag that checks for the appropriate hidden field to prevent the other 2 from loading.
That sounds interesting, but I’m not sure what conditional to use or where.
I’m just trying to get a handle of how you are using the forms.
Here are my forms:
Step 1
<txp:mem_simple_form table="txp_category" id_field="id" id_insert="0" success_form="step-2">
<txp:mem_form_secret name="string_type" value="article" />
<txp:mem_form_secret name="string_parent" value="root" />
<fieldset id="add-cat-info">
<legend>Add a Category</legend>
<div>
<txp:mem_form_text name="string_title" label="Title of Category" />
<txp:mem_form_secret name="randuid_name" />
<txp:mem_form_secret name="randuid_lft" />
<txp:mem_form_secret name="randuid_rgt" />
</div>
</fieldset>
<txp:mem_form_submit label="Next" />
</txp:mem_simple_form>
Step 2
<txp:mem_simple_if_ps name="string_title">
<txp:mem_simple_form table="textpattern" id_field="ID" id_insert="0" Annotate="1" success_form="step-3">
<txp:mem_form_secret name="int_Annotate" value="1" label="Comments On" />
<txp:mem_form_secret name="string_section" value="category-info" label="Section" />
<txp:mem_form_secret name="string_category1" value='<txp:mem_simple_ps name="string_title" />' label="Category" />
<txp:mem_form_secret name="string_title" value='<txp:mem_simple_ps name="string_title" />' />
<txp:mem_form_secret name="now_posted" value="" />
<txp:mem_form_secret name="string_AuthorID" value='<txp:ign_user_info type="name" />' label="Author" />
<fieldset>
<legend>About <txp:mem_simple_ps name="string_title" /></legend>
<div>
<txp:mem_form_select name="string_custom_13" label="Some Metadata" items="option 1,option 2,option 3" values="option1,option2,option3" />
</div>
</fieldset>
<txp:mem_form_submit />
</txp:mem_simple_form>
</txp:mem_simple_if_ps>
Step 3
<h1>Confirmation</h1>
As I said, Step 2 loads successfully upon submitting Step 1, and the simple_ps data is successfully transfered from the user input of Step 1 into Step 2. But when I submit Step 2, nothing happens in the system— I don’t get a new article, and Step 3 doesn’t appear. Instead, I see Step 1 again.
I have tried wrapping the Confirmation header in Step 3 with <txp:mem_simple_if_ps> and <txp:mem_simple_if_ps name="string_title">, but the behavior is the same.
I can see setting a txp:variable with a hidden field and checking the value before rendering the forms, but it seems like the primary issue is that no data goes into the textpattern table when submitting Step 2; since it’s not a success, the success form indicated doesn’t render. Step 2 renders correctly, but it does not send anything to the database.
Maybe I’m wrong. Will this plugin let me submit input from a form rendered as the success_form of previous input? If so, where is the flaw in my markup?
Thank you again for your magnificent support!
Last edited by johnstephens (2009-07-13 19:25:11)
Offline
Any ideas on this?
Offline
Okay, I’ve simplified my code significantly, and I think this may help to isolate the problem. this is my form, with comments:
<!-- Check if data from STEP 2 was posted. --> <txp:mem_simple_if_ps name="string_custom_13"> <!-- We have data from STEP 2. --> <h1>Here is your data from STEP 2: <txp:mem_simple_ps name="string_custom_13" /></h1> <txp:else /> <!-- We have NO data from STEP 2.Render STEP 1: Category Input form. --> <txp:mem_simple_form table="txp_category" id_field="id" id_insert="0" success_form="_category-confirm"> <!-- This form adds an entry to the txp_category table as specified above. --><h1>STEP 1: Category Input form</h1> <txp:mem_form_secret name="string_type" value="article" /> <fieldset id="add-category-info"> <legend>Add a Category</legend> <div> <txp:mem_form_text name="string_title" label="Category" /><txp:mem_form_secret name="randuid_name" /> <txp:mem_form_secret name="randuid_lft" /> <txp:mem_form_secret name="randuid_rgt" /> <!-- These fields are required to successfully post a category. This method is passing random unique strings into these fields.There must be a cleaner way to generate lft and rgt and category name, but I will post a new thread for these questions. --> <txp:mem_form_secret name="string_parent" value="root" /> </div> </fieldset> <txp:mem_form_submit label="Next" /> </txp:mem_simple_form> </txp:mem_simple_if_ps><!-- Check if data from STEP 1 was posted. --> <txp:mem_simple_if_ps name="randuid_name"> <!-- We have data from STEP 1.Render STEP 2: Article Input form. --> <txp:mem_simple_form table="textpattern" id_field="ID" id_insert="0" success_form="_record-confirm"> <!-- This form adds an entry to the textpattern table as specified above. --><h1>STEP 2: Article Input form</h1> <txp:mem_form_secret name="int_Annotate" value="1" label="Comments On" /> <txp:mem_form_secret name="string_section" value="category-info" label="Section" /><txp:mem_form_secret name="string_category1" value='<txp:mem_simple_ps name="randuid_name" />' label="Category" /> <!-- We want to categorize this article under the category created in STEP 1.Here, we pass the category name into a hidden category field. --><txp:mem_form_secret name="string_title" value='<txp:mem_simple_ps name="string_title" />' /> <!-- The article will have the same title as the category. --><txp:mem_form_secret name="now_posted" value="" /> <txp:mem_form_secret name="string_AuthorID" value='<txp:ign_user_info type="name" />' label="Author" /> <!-- Enter the author name from the current ign_user. --> <fieldset> <legend> About <txp:mem_simple_ps name="string_title" /> </legend> <div> <txp:mem_form_select name="string_custom_13" label="Select something" items="option 1, option 2, option 3" values="option 1, option 2, option 3" /> </div> </fieldset> <txp:mem_form_submit /> </txp:mem_simple_form> </txp:mem_simple_if_ps>
I’m no longer loading STEP 2 in the success_form of STEP 1.
Last edited by johnstephens (2009-07-16 20:27:31)
Offline
Here are the results.
Can anyone see where I’ve made a mistake in my markup, logic, or anywhere else?
I’d love to hear any guidance, support, suggestions, or feedback. Please let me know what you think.
Offline