Re: radio button trouble

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Monday, September 22, 2008, 5:16:35 PM, [email protected] wrote:

> 11:11:02,383 line:190 ERROR [FeeController->validatePage] Field error in
> object 'feeSetup' on field 'programId': rejected value 
> [[Ljava.lang.String;@19fbd7c]; codes 
> [typeMismatch.feeSetup.programId,typeMismatch.programId,typeMismatch.java.lang.Long,typeMismatch];
> arguments 
> [org.springframework.context.support.DefaultMessageSourceResolvable: codes
> [feeSetup.programId,programId]; arguments []; default message 
> [programId]]; default message [Failed to convert property value of type
> [java.lang.String[]] to required type [java.lang.Long] for property 
> 'programId'; nested exception is java.lang.NumberFormatException: For 
> input string: ",621024"]
>
> Why is it treating the radio input like a multiselect drop down?

I guess it has nothing to do with FreeMarker. But anyway, as far as I
understand (but I'm not using the Spring libs) the message says that
you have receive the "programId" property twice (as HTTP request
parameters, I guess), once with value "", and once with value
"621024", and that results in this not too intelligent error message.
So, in the submitting HTML form you have two fields with that name.
And now I see you have radio buttons... well, two can't be checked at
the same time, but maybe you have a non-radio input with the same name
somewhere? Look at the HTTP request parmeters closely.

> Snippet of the template markup.
>
>   <@display.table name="programs" id="program" style="width:90%" sort=
> "external"  pagesize=20  size=fullSize export=false defaultsort=2 class=
> "defaultTable" partialList=true >
>           <@display.column  >
>                 <input style="width:auto; border:0px;" type="radio" name=
> "programId" value="${program.id?c}" />
>         </@display.column> 
>
>
> Snippet of the generated html. Looks like a good radio button to me.
>
> <tr class="oddRow">
> <td>                <input style="width:auto; border:0px;" type="radio"
> name="programId" value="621023" />
> </td>
> <td>621023</td>
> <td>Nat Benefit Serv.</td>
> <td>National Benefit Services 2</td></tr>
> <tr class="evenRow">
> <td>                <input style="width:auto; border:0px;" type="radio"
> name="programId" value="621024" />
> </td>
> <td>621024</td>

-- 
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.