I think I've gotten to the bottom of my problem. I was using a custom
form to display the form created in my controller. And yes, there are
numerous forms on this page. And, this form is in a LOADed component using
AJAX.
If I use this for the custom form definition:
<table>
{{=form.custom.begin}}
<tr>
<td>
{{=form.custom.label.site}}
</td>
<td>
{{=form.custom.widget.site}}
</td>
<td>
{{=form.custom.submit}}
</td>
</tr>
{{=form.custom.end}}
<tr>
<td></td>
<td>
{{=grid}}
</td>
<td></td>
</tr>
</table>
Notice that my form.custom.begin/end are weirdly intersperse within my
table. If I take them out and put them outside the <table></table>
elements then it works fine.
Thanks, I do appreciate you all taking time to look at the code. Too bad I
didn't show you the right code.....
-Jim
On Wednesday, March 13, 2013 12:18:43 PM UTC-5, Anthony wrote:
>
> The main reason for setting your own formname is if you have more than one
> form on the same page that would otherwise be assigned the same default
> name by SQLFORM.
>
> Anthony
>
> On Wednesday, March 13, 2013 12:15:55 PM UTC-4, Niphlod wrote:
>>
>> nope. formname "overrides" the hidden field value _formname
>>
>> On Wednesday, March 13, 2013 5:11:48 PM UTC+1, Jim S wrote:
>>>
>>> Thanks Anthony. If I put formname='membership' in the
>>> form.process().accepted like this:
>>>
>>> form.process(formname='membership').accepted:
>>>
>>> Then does that refer to the _id arg set by
>>> SQLFORM.factory(_id='membership')???
>>>
>>> -Jim
>>>
>>>
>>>
>>> On Wed, Mar 13, 2013 at 10:51 AM, Anthony <[email protected]> wrote:
>>>
>>>> Not sure if this is the problem, but formname is an argument of
>>>> .process(), not .__init__().
>>>>
>>>> Anthony
>>>>
>>>> On Wednesday, March 13, 2013 11:29:07 AM UTC-4, Jim S wrote:
>>>>>
>>>>> I have the following code:
>>>>>
>>>>> form = SQLFORM.factory(Field('auth_group', 'integer',
>>>>> label='Groups',required
>>>>> =True), formname='membership', submit_button='Add Membership')
>>>>>
>>>>> if form.process().accepted:
>>>>> user_update = form.vars
>>>>> if user_update['auth_group'] and user_update['auth_group'] != '0':
>>>>> db.auth_membership.insert(user_id=userId, group_id=user_update[
>>>>> 'auth_group'])
>>>>>
>>>>> redirect('#')
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> When I click on my add button it refreshes the page, but nothing else
>>>>> happens. It never gets past the form.process().accepted:
>>>>>
>>>>> I've been staring at this for an hour and can't see what I'm doing
>>>>> wrong. What am I not seeing?
>>>>>
>>>>> -Jim
>>>>>
>>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "web2py-users" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/web2py/8p1jHtpxJNU/unsubscribe?hl=en.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.