Fórum

Unable to validate AUI radio

thumbnail
Suneel Yadav, modificado 10 Anos atrás.

Unable to validate AUI radio

New Member Postagens: 14 Data de Entrada: 07/09/13 Postagens Recentes
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 10 Anos atrás.

RE: Unable to validate AUI radio

Expert Postagens: 252 Data de Entrada: 06/04/12 Postagens Recentes
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 9 Anos atrás.

RE: Unable to validate AUI radio

Junior Member Postagens: 29 Data de Entrada: 24/03/14 Postagens Recentes
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 9 Anos atrás.

RE: Unable to validate AUI radio

Junior Member Postagens: 49 Data de Entrada: 22/03/14 Postagens Recentes
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 7 Anos atrás.

RE: Unable to validate AUI radio

Junior Member Postagens: 76 Data de Entrada: 26/02/15 Postagens Recentes
is there a solution for this?
thumbnail
Parth Ghiya, modificado 7 Anos atrás.

RE: Unable to validate AUI radio

Junior Member Postagens: 35 Data de Entrada: 02/07/13 Postagens Recentes
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