Foros de discusión

Unable to validate AUI radio

thumbnail
Suneel Yadav, modificado hace 10 años.

Unable to validate AUI radio

New Member Mensajes: 14 Fecha de incorporación: 7/09/13 Mensajes recientes
Dear All,
i am creating a portlet with some radio button and one submit button, i want to validate the input field , if user click on submit button then error message display and form will not submit.

my code is
<aui:field-wrapper>
<aui:input inlineLabel="right" id="report" name="report" type="radio" value="Radio1" />
<aui:input inlineLabel="right" id="report" name="report" type="radio" value="Radio2" />
<aui:input inlineLabel="right" id="report" name="report" type="radio" value="Radio3" />
<aui:input inlineLabel="right" id="report" name="report" type="radio" value="Radio4" />
</aui:field-wrapper>


if i use <aui:validator name="required"/> it generate NullPointerException.
thumbnail
Byran Zaugg, modificado hace 10 años.

RE: Unable to validate AUI radio

Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
I think you either need unique id's or you should just leave the id attribute out, as the taglib will generate id's for you.

For HTML, radio inputs share the same name but cannot have identical id's.
thumbnail
Suresh Yadagiri, modificado hace 9 años.

RE: Unable to validate AUI radio

Junior Member Mensajes: 29 Fecha de incorporación: 24/03/14 Mensajes recientes
I have the same problem. tried with following code

<aui:field-wrapper name="gender" required="true">
<aui:input inlineLabel="right" name="gender" type="radio" value="1" label="male" />
<aui:input inlineLabel="right" name="gender" type="radio" value="2" label="female" />
</aui:field-wrapper>

No validation error message is displaying if I submit the form without gender section.
shankardayal vijayakumar, modificado hace 9 años.

RE: Unable to validate AUI radio

Junior Member Mensajes: 49 Fecha de incorporación: 22/03/14 Mensajes recientes
make either male or female checked

<aui:input inlineLabel="right" name="gender" type="radio" value="1" label="male" checked="true"/>
<aui:input inlineLabel="right" name="gender" type="radio" value="2" label="female"/>
Robert Meissner, modificado hace 7 años.

RE: Unable to validate AUI radio

Junior Member Mensajes: 76 Fecha de incorporación: 26/02/15 Mensajes recientes
is there a solution for this?
thumbnail
Parth Ghiya, modificado hace 7 años.

RE: Unable to validate AUI radio

Junior Member Mensajes: 35 Fecha de incorporación: 2/07/13 Mensajes recientes
Hi Suneel,

Try Adding required=true in all the options.

Example:

<aui:input inlineLabel="right" id="report" name="report" type="radio" value="Radio1" required="true" />

Even that in one option should do the trick.

Thanks & Regards,
Parth G