The URL with the form in is web2py_xlchart_dashboard/charts/user_charts so
without an action it will submit to *user_charts*, but I need it to submit
to* subscribe_form *which is the function that was called by AJAX to
generate the Form.
or am I not understanding something?
Simon
On Wednesday, 7 November 2012 19:26:46 UTC, Derek wrote:
>
> Why would you need to create an action for the form? Are you not using
> self submit?
>
> On Wednesday, November 7, 2012 12:22:03 PM UTC-7, Simon Carr wrote:
>>
>> I have this piece of code that calls a function in my controller when
>> clicked.
>>
>> {{=A('Add to My Charts',callback=URL('subscribe_form',vars={'chartname':
>> chart.chartName}),target=str(chart.chartName).replace('.','_'))}}
>>
>>
>> The subscribe_form function looks like this
>>
>> def subscribe_form():
>>
>> form =
>> SQLFORM(db.user_chart,fields=['title','description'],hidden=dict(chartname=request.vars['chartname']))
>> if form.process().accepted:
>> response.flash = 'form accepted'
>> elif form.errors:
>> response.flash = 'form has errors'
>> else:
>> response.flash = 'please fill out the form'
>> return form
>>
>> The Form is created by AJAX, but it's action is blank.
>>
>> Do I have to specify the action myself if I am build a Form via AJAX?
>>
>> Simon
>>
>
--