> First of all, checkout @helper.select, as it can probably help you here,
> eg:
> @helper.select(form("networkInterfaces"), networkInterfaces.map(i =>
> (i.Name -> i.DisplayName))
> Now to solving your problem:
> 1) Have you checked what gets rendered? Is what you are expecting in the
> value field?
> 2) Have you checked what is going over the wire using browser developer
> tools (eg, firebug, or the chrome developer console)?
> Cheers,
> James
> On Thursday, 1 November 2012 14:49:06 UTC+11, Ben wrote:
>> Hi guys,
>> So I have an issue with my play/scala atm and was wondering if anyone
>> could help.
>> So what I have is a configuration page that is allowing you to set the
>> network interface adapter, and then you can submit the form and save the
>> settings.
>> So i display the list of network interfaces with scala with the following
>> code:
>> <select id="networkInterfaces">
>> <option value="">First Available</option>
>> @for(interface <- networkInterfaces) {
>> @if(interface.Name == configs.last.**networkInterfaceName)
>> {
>> <option selected="selected"
>> value="@interface.Name">@**interface.DisplayName</option>
>> } else {
>> <option value="@interface.Name">@**
>> interface.DisplayName</option>
>> }
>> }
>> </select>
>> And my form code:
>> public static Result newConfiguration() {
>> Form<SystemConfiguration> filledForm =
>> configForm.bindFromRequest();
>> if (!filledForm.hasErrors()) {
>> SystemConfiguration.create(**filledForm.get(),
>> session("name"));
>> }
>> }
>> But my problem is if I load the value as selected, it displays as if it
>> is selected in html and even $('networkInterfaces').val() is correct but if
>> I do not actually select anything manually then for some reason the value
>> passed to the filledForm.get() is the @interface.DisplayName instead of
>> @interface.Name
>> Have I done something wrong?
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/4Yoz4pgtNd0J.
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framework+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.