Question

We have the following radio buttons which pass the selected one to the parameter "type" in our method

    <input type="radio" name="type" value="a">
        Selection 1
    <input type="radio" name="type" value="b">
        Selection 2
    <input type="radio" name="type" value="c">
        Selection 3

What I don't have is that if a different field validation fails(so no login was entered), then this is the only widget that is cleared....all my other fields correctly persist the data since they have a value="${paramName}"

How can one get radio buttons to work this way as well?

thanks, Dean

Was it helpful?

Solution

I use formfield instead of playframeworks 'field' tag as mine has bug fixes

basically, this is what I came up with(not the prettiest but it works)...

#{formfield 'type'}
<input type="radio" name="type" value="a" #{if field.value=='a'}checked="checked"#{/if}>
    Selection 1
<input type="radio" name="type" value="b" #{if field.value=='b'}checked="checked"#{/if}>
    Selection 2
<input type="radio" name="type" value="c" #{if field.value=='c'}checked="checked"#{/if}>
    Selection 3
#{/formfield}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top