Forums de discussion

Unable to validate AUI radio

thumbnail
Suneel Yadav, modifié il y a 10 années.

Unable to validate AUI radio

New Member Publications: 14 Date d'inscription: 07/09/13 Publications récentes
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, modifié il y a 10 années.

RE: Unable to validate AUI radio

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
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, modifié il y a 9 années.

RE: Unable to validate AUI radio

Junior Member Publications: 29 Date d'inscription: 24/03/14 Publications récentes
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, modifié il y a 9 années.

RE: Unable to validate AUI radio

Junior Member Publications: 49 Date d'inscription: 22/03/14 Publications récentes
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, modifié il y a 7 années.

RE: Unable to validate AUI radio

Junior Member Publications: 76 Date d'inscription: 26/02/15 Publications récentes
is there a solution for this?
thumbnail
Parth Ghiya, modifié il y a 7 années.

RE: Unable to validate AUI radio

Junior Member Publications: 35 Date d'inscription: 02/07/13 Publications récentes
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