Default value for html select?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Default value for html select?

Kevin Salvesen
Hey,

I am currently using a drop-down list in my Seaside application, but it always takes the first item of the list as default value. Is there a way to specify which item to take as default value?

For reference here is the code I'm using to display the drop-down list:

================================

html select
        list: MyCoursesModel listOfUsersByEmail; 
        selected: [ program manager. ];
        callback: [ :email | program manager: (MyCoursesModel userByEmail: email). ].

================================

Cheers,

Kevin

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Default value for html select?

Boris Popov, DeepCove Labs (SNN)

Kevin,

 

Couple of important notes,

 

1.       You need to provide an actual selected object, not a block

2.       You do not need to worry about string/object conversion yourself, callback will always get an actual object from the list, not its label

 

html select

        list: MyCoursesModel users;

        selected: program manager;

        callback: [:user | program manager: user]

 

Hope this helps,

 

-Boris

 

--

DeepCove Labs Ltd.

+1 (604) 689-0322

4th floor, 595 Howe Street

Vancouver, British Columbia

Canada V6C 2T5

http://tinyurl.com/r7uw4

 

PacNet Services (Europe) Ltd.

+353 (0)61 714-360

Shannon Airport House, SFZ

County Clare, Ireland

http://tinyurl.com/y952amr

 

CONFIDENTIALITY NOTICE

 

This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments.

 

Thank you.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Kevin Salvesen
Sent: 19 October 2010 11:18
To: [hidden email]
Subject: [Seaside] Default value for html select?

 

Hey,

 

I am currently using a drop-down list in my Seaside application, but it always takes the first item of the list as default value. Is there a way to specify which item to take as default value?

 

For reference here is the code I'm using to display the drop-down list:

 

================================

 

html select

        list: MyCoursesModel listOfUsersByEmail; 

        selected: [ program manager. ];

        callback: [ :email | program manager: (MyCoursesModel userByEmail: email). ].

 

================================

 

Cheers,

 

Kevin


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside