Thanks!!! It worked!! Now I'm trying with other scripts! Thank you!

On Fri, Mar 11, 2011 at 6:32 PM, Bruno Rocha <[email protected]> wrote:

>
> def autopostback():
>     script = SCRIPT("""
>                     $('document').ready(function(){
>                         $('select').change(function(){
>                             $('form').submit();
>                         });
>                     });
>                     """)
>     form =
> SQLFORM.factory(Field("project",label="Project",requires=IS_IN_DB(db(
> db.project.id>0),'project.id','project.name',error_message="Please pick a
> project from the list")))
>
>     if form.accepts(request.vars, keepvalues=True):
>         response.flash = 'populate with %s' % form.vars.project #populate
> powertable
>
>     return dict(script=script,form=form)
>
>
>
> 2011/3/11 Ismael Alejandro <[email protected]>
>
> Any help??
>>
>>
>> On Fri, Mar 11, 2011 at 5:32 PM, Ismael Alejandro <[email protected]
>> > wrote:
>>
>>> And, where do I type it?? The form is auto generated with SQLFORM or do I
>>> have to build the SQLFORM with HTML??
>>>
>>>
>>> On Fri, Mar 11, 2011 at 5:18 PM, Bruno Rocha <[email protected]>wrote:
>>>
>>>> try
>>>>
>>>> onchange="this.form.submit();"
>>>>
>>>> or using *Unobtrusive jquery way*
>>>>
>>>> $(document).ready(function(){
>>>>    $('#yourcombo').change(function() {
>>>>        $('form').submit()
>>>>    });
>>>> });
>>>>
>>>>
>>>>
>>>>
>>>> 2011/3/11 Ialejandro <[email protected]>
>>>>
>>>> Hi everybody!!!
>>>>>
>>>>> How could I make an auto submit with a dropdown???
>>>>>
>>>>> I have this:
>>>>>
>>>>>
>>>>>  def index():
>>>>>
>>>>> form =
>>>>> SQLFORM.factory(Field("project",label="Project",requires=IS_IN_DB(db(
>>>>> db.project.id>0),'project.id','project.name',error_message="Please
>>>>> pick a project from the list")))
>>>>>    if FORM.accepts(form,request.vars, keepvalues=True):
>>>>> #populate powertable
>>>>>
>>>>>   return dict(form=form)
>>>>>
>>>>>
>>>>> So with that I have a dropdown and a submit button, I need to submit
>>>>> the selected value from dropdown when a user changes it. How could I
>>>>> do this?? I'm thinking about javascript with the event OnChange but
>>>>> how could I use it??
>>>>>
>>>>>
>>>>> Thanks!
>>>>>
>>>>
>>>>
>>>
>>
>

Reply via email to