Thanks for the suggestion.

 

You mean:

| <Country Name> | <Check Box> |

?

 

You just mean for the countries selected?

And I could hide the actual check box itself? Would that be enough to ensure
the values are saved with the form? 

 

I tried to use a text box instead, but it just proved more difficult! I
think I may just stick with the multiple widget - if it ain't broke, don't
fix it!

 

From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of
Tiago Almeida
Sent: Monday, 22 February 2010 6:20 p.m.
To: web2py@googlegroups.com
Subject: Re: [web2py] Multiple Select Widget

 

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 <michael.how...@gmail.com>
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 web...@googlegroups.com.
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.com
<mailto:web2py%2bunsubscr...@googlegroups.com> .
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 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.

-- 
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