Textpattern Forum

You are not logged in. Register | Login | Help

#51 2010-10-22 13:11:49

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 313

Re: mem_simple_form

I’m revisiting this, mainly because it offers a simpler solution than multiple processing with smd_query (no offence Stef!).

One thing I would like to do is to display a new, blank form after submission so that the user can see an update table of entries straight away. But if I try to set success_form as the same form that mem_form appears on, I get an internal server error.

What I’m trying to do is display a table of existing values with smd_query, present the user with a form to add a new entry, and then redisplay the table again with the new value in it.

Offline

#52 2010-10-22 14:38:42

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

Re: mem_simple_form

That is unsupported. Put javascript in the success_form to reload the initial form.

Offline

#53 2010-10-25 12:29:53

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 313

Re: mem_simple_form

Actually, I figured when I looked at the database that the internal server must be cause by the form resubmitting itself with multiple values – my table had many hundreds of entries!

If I use javascript in the successform, do I need to unset the values from the form? I think you mentioned this to someone else in one of your plugin-threads – sorry, I’ve read them all but didn’t catch on to this one.

Offline

#54 2010-10-25 13:59:17

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

Re: mem_simple_form

Use javascript to reload the URL that renders the form. You may need to add a query string to force the reload. When the page reloads, the form will be properly initialized and ready for another submission.

Offline

#55 2011-02-14 14:10:15

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: mem_simple_form

Hello Michael.

Thank you first for this amazing plugin.

I’m trying to update the values recorded in the db from the smd_bio plugin through the use of a dashboard, using the jmd_dashboard plugin and mem_form.

Here’s my code:

<txp:mem_simple_form table="smd_bio">
<txp:mem_form_text name="table_country" label="Country" break="" />
<txp:mem_form_submit />
</txp:mem_simple_form>

It’s working, but instead of updating the information for the current logged in user, it adds another row in my table. Is there a value I can add to update the information for the current logged in user ?

Thanks !


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#56 2011-02-14 15:03:25

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 1,912
Website

Re: mem_simple_form

Guillaume, IIRC the trick is to use the attribute pair id_field="user_ID" id_insert="0" in your mem_simple_form tag and in your contained form use mem_form_secret to inform the plugin about the user ID to update, e.g. something like:

<txp:mem_simple_form table="smd_bio" id_field="user_ID" id_insert="0">
<txp:mem_form_text name="table_country" label="Country" break="" />
<txp:mem_form_secret name="int_user_id" value="{current-user-id-here}" />
<txp:mem_form_submit />
</txp:mem_simple_form>

(not familiar with the smd_bio structure so you might need to adapt this).

Last edited by jakob (2011-02-14 15:03:53)


TXP Builders – finely-crafted code, design and txp

Offline

#57 2011-02-14 15:40:08

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: mem_simple_form

Ahhh vielen Dank Jakob ! It’s working…

<txp:mem_simple_form table="smd_bio" id_field="user_ref" id_insert="0">
<txp:mem_form_text name="table_country" label="Country" break="" />
<txp:mem_form_secret name="int_user_ref" value="{userA}" />
<txp:mem_form_submit />
</txp:mem_simple_form>

Just a minor bug: It’s updating all users: userA, userB (?!)… I’m not sure why… Is this related to the way I use the call above ? Or the way smd_bio is built ?

Last edited by hablablow (2011-02-14 15:42:15)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#58 2011-03-16 09:30:21

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: mem_simple_form

I’m following the above question… When I update an existing value of a field and press the submit button, it is recorded in the DB… Good !

I run into a problem when it comes to empty a value from a field, the empty value is not recorded in the DB.

In other words I can’t delete a value already entered, I can only replace it with a new value…

Am I missing something obvious here ? An attribute for meme_form that would allow to delete a value already recorded in the DB by simply submitting the value of an empty field…

Cheese !

Last edited by hablablow (2011-03-18 10:30:57)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#59 2011-03-18 10:28:51

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: mem_simple_form

Tried and tried and kept trying… It just doesn’t work… I’m not sure if this is possible…
Help !


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#60 2011-05-06 22:04:56

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 345

Re: mem_simple_form

hablablow dijo:

Ahhh vielen Dank Jakob ! It’s working…

<txp:mem_simple_form table="smd_bio" id_field="user_ref" id_insert="0">
<txp:mem_form_text name="table_country" label="Country" break="" />
<txp:mem_form_secret name="int_user_ref" value="{userA}" />
<txp:mem_form_submit />
</txp:mem_simple_form>

Just a minor bug: It’s updating all users: userA, userB (?!)… I’m not sure why… Is this related to the way I use the call above ? Or the way smd_bio is built ?

I have the same problem with the same table (smd_bio). I try to uptade a field value for userA and it is update for all the user in the smd_bio table. ¿did you found the solution? This is my code:

<txp:mem_simple_form table="smd_bio" id_field="user_ref" id_insert="0">
<txp:mem_form_secret name="int_user_ref" value="{userA}"/>
<txp:mem_form_text name="string_type"  label="User type" required="1" break=""/>
<txp:mem_form_submit />
</txp:mem_simple_form>

Last edited by milosevic (2011-05-06 22:09:21)


<txp:rocks/>

Offline

Board footer

Powered by FluxBB