something like this?

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

});

and create a new action in default.py

@auth.requires_login()
def register_new_option():
     from serializer import json
     (value,error) = db.optiontable.optionvalue.requires
(request.vars.option)
     if not error:
         return json(dict(id=db.optiontable.insert(optionvalue=value)
     else:
         return json(dict(id=0,error=error))


On Jan 22, 12:31 pm, DenesL <denes1...@yahoo.ca> wrote:
> How would you validate the field?.

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

Reply via email to