Why not do this? http://web2py.com/plugins/default/multiselect
On Feb 22, 5:19 am, Tiago Almeida <[email protected]> wrote: > > Is there a better way to do this type of functionality rather than > > using a hidden multiple widget? > > Why not make a simple table/list of checkboxes next to each country? > --- > Tiago > > On Mon, Feb 22, 2010 at 10:46 AM, Michael Howden > <[email protected]>wrote: > > > Hey, > > > I have a need to allow the user to select multiple countries for a > > single record (in this case the record is a project - which could be > > occurring in a number of different countries). > > > I've developed a widget which allows the user to select a country from > > a drop down, then click a button which uses JS to add it to a table > > within the widget and also selecting it on a hidden web2py multiple > > widget. The hidden multiple widget ensures that the values are saved > > with the form. > > Similarly, there is a "x" next to each country which has been selected > > and is displayed on the table, which will run some JS to remove it > > from the table, and de-select it on the hidden widget. > > > This code is working, but I have a few questions: > > > * Is it fine to presume that all users will be able to use JS on their > > browsers? > > * Is there a better way to do this type of functionality rather than > > using a hidden multiple widget? Could the selected countries be read > > directly from the table? Would it be more efficient to use a hidden > > string widget? Where is the code which gets the values from the table > > and saves them to the DB? > > * Is there any dangers/issues/considerations in using a field with > > multiple = True, rather than using a linking table for many to many > > relationships? Or even using a field with multiple = True for a one to > > many relationship? > > > Please let me know if it would simplify matters (or somehow > > contribute) if I shared my code (web2pyslice?). > > > Cheers > > > Michael > > > -- > > 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]<web2py%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/web2py?hl=en. -- 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.

