<script>
jQuery(document).ready(function(){
  jQuery('#mySelect').change(function(){
    if(jQuery('#mySelect').val()=='Specify...')
      var newoption  = prompt("Your choice:","");
      jQuery.post({url:'{{=URL
(r=request,f='register_new_option')}}',data:'option='+escape
(newoption)});
      jQuery('#mySelect').prepend('<option>' + newoption + '</
option>');
  });
});

and create a new action in default.py

@auth.requires_login()
def register_new_option():
      insert request.vars.option in the table used to validate options

On Jan 22, 11:50 am, NeonGoby <[email protected]> wrote:
> Massimo,
>
> That for the above code.
>
> I have to change one line:
>                                 jQuery('#mySelect').prepend('<option>' + 
> prompt("Your choice:","")
> + '</option>');
>
> to get the new option appended to the select list.
>
> However, the validator didn't accept this new option when the form is
> submitted.  How to overcome this problem?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to