掲示板

Unable to validate AUI radio

thumbnail
10年前 に Suneel Yadav によって更新されました。

Unable to validate AUI radio

New Member 投稿: 14 参加年月日: 13/09/07 最新の投稿
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
10年前 に Byran Zaugg によって更新されました。

RE: Unable to validate AUI radio

Expert 投稿: 252 参加年月日: 12/04/06 最新の投稿
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
9年前 に Suresh Yadagiri によって更新されました。

RE: Unable to validate AUI radio

Junior Member 投稿: 29 参加年月日: 14/03/24 最新の投稿
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.
9年前 に shankardayal vijayakumar によって更新されました。

RE: Unable to validate AUI radio

Junior Member 投稿: 49 参加年月日: 14/03/22 最新の投稿
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"/>
7年前 に Robert Meissner によって更新されました。

RE: Unable to validate AUI radio

Junior Member 投稿: 76 参加年月日: 15/02/26 最新の投稿
is there a solution for this?
thumbnail
7年前 に Parth Ghiya によって更新されました。

RE: Unable to validate AUI radio

Junior Member 投稿: 35 参加年月日: 13/07/02 最新の投稿
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