Your question is the same as this one:

http://stackoverflow.com/questions/6459974/how-to-add-option-using-multiselect-jquery-plugin

The answer you want is the first one.

I do not have a complete example of integration with web2py. Give it a try 
and if, necessary, I will take a second look.

Anyway, consider the fact you are basically allowing users to type whatever 
they want. You may as well use the default validator.

On Sunday, 29 July 2012 12:51:48 UTC-5, Don_X wrote:
>
> Hello web2py users ...
>
> This is a question in 2 folds :
>
> I wish to use the multiselect plugin as a widget on a form ( SQLFORM ) as 
> opposed to on a crud as demonstrated in the following example  :
>
> http://www.web2py.com/plugins/default/multiselect
>
> However there is one additional detail that I wish to make available - so 
> let me elaborate a bit on the issue at hand.
>
> Auth_users need to specify their spoken languages upon registration and 
> they can and should be able to select more than 1 or 2  speaking languages !
> for example:  in my case, multiple checkboxes ( 4 checkboxes )  to choose 
> the spoken languages
> 1- English ( checkbox )
> 2- French ( checkbox )
> 3- Spanish ( checkbox )
> 4 - Other ( checkbox ) : ( specify ) with a blank input field where the 
> user will specify the langage ( or the additional languages separated by a 
> comma in the input field ) !
>
> so first : I am unable to use the plugin multiselect on a form as a widget 
> ... if I can ... how do I set it up as a widget for forms .. instead of 
> crud ??
>
> and second : how do I code-ready the 4th option above in my  model, my 
> controller to the view for the form ??? ... if in my db.py file, I have 
> this defined :
>
>
>
> user_lang = ('French','English','Spanish','Other')
>>
>> db.define.table ( 'auth_user',
>>     Field('first_name', type='string',
>>           label=T('First Name')),
>>     Field('last_name', type='string',
>>           label=T('Last Name')),
>>     Field('language_spoken','list:string',label=T('I speak'), 
>>               requires=IS_IN_SET((1,2,3,4),user_lang, multiple=True)))
>>
>>
> off course, I want the 'Other' value in the user_lang tuple defined to be 
> a list of languages defined by the subscriber upon registration ! ..
>
> How do i go about this ??? ... please help ! ... the plugin multiselect 
> does not do it for me ! .. i used checkboxes  ... but i get them in one 
> single column and it is taking much space on the form ...
>  and I cannot get the 4th option as a checkboxe with an input field !
>
> Can someone help me with this so I can make it look good, like  .. may be 
> one row ... or possibly 2 rows 2 columns for the 4 checkboxes ??? ... what 
> about the input field for the fourth option in the set !!???
>
> thank you.
>

-- 



Reply via email to