On Thursday 04 October 2007 10:50:00 vimal wrote:
> hi all,
>
> i am still a learner in turbogears
>
> i have a select tag with options as follows:
>
> <select>
> <option py:for="mb in range(32,100)">${mb}</option>
> </select>
>
> and if i want the list to show the value "50" when the page is loading
> what should be done

There are several solutions to that problem - but the easiest seems to me to 
use the 

SingleSelectField

widget, such as this:


selectfield = SingleSelectField(options=xrange(32, 100))

@expose(...)
def mycontrollermethod(self, ...):
      return dict(selectfield=selectfield, selectfieldvalue=50, ...)

In the template then you do this:


${selectfield.display(selectfieldvalue)}

That should be it.

diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to