Domanda

In View.jsp I created a form by using . there are some inputs and 3 select-box on it, actually I want to validate all of them. for inputs I used but I don't know how can I validate my

Actually I want to validate these three :

  1. <aui:select id="birthday_day" name="birthday_day">
  2. <aui:select id="birthday_month" name="birthday_month">
  3. <aui:select id="birthday_year" name="birthday_year">

This is my view.jsp

        <portlet:actionURL var="myUrl">
    </portlet:actionURL>
<aui:form enctype="multipart/form-data" action="<%= myUrl %>" method="POST" name="fm">
 <table border="0" bgcolor=#ccFDDEE>
        <tr>
            <td colspan="2" align="center"><b>Recruiment Form</b></td>
        </tr>
        <tr>
            <td colspan="2" align="center"></td>
        </tr>
        <tr>
            <td><b>First Name:<span>*</span></b></td>
            <td>
                <aui:input name="fname" type="text">
                    <aui:validator name="required"/>
                </aui:input>
            </td>
        </tr>

        <tr>
            <td><b>Last Name:<span>*</span></b></td>
            <td>
                <aui:input name="lname" type="text">
                    <aui:validator name="required"/>
                </aui:input>
            </td>
        </tr>
        <tr>
            <td><b>Father Name:<span>*</span></b></td>
            <td>
                <aui:input name="father_name" type="text">
                    <aui:validator name="required"/>
                </aui:input>
            </td>
        </tr>
        <tr>
            <td><b>Birth Date:<span>*</span></b></td>
            <td>
                <aui:select id="birthday_day" name="<portlet:namespace/>birthday_day">
                    <aui:option value="0">روز</aui:option>
                    <%
                        for(int i=1;i<=31;i++) {
                    %>
                    <aui:option value="<%=i%>"><%=i%></aui:option>
                    <%
                        }
                    %>
                </aui:select>
                /
                <aui:select id="birthday_month" name="birthday_month">
                    <aui:option value="0">ماه</aui:option>
                    <%
                        String[] monthBirthDay = {"فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"};
                        for(int j=0;j<monthBirthDay.length;j++) {
                    %>
                    <aui:option value="<%=j+1%>"><%=monthBirthDay[j]%></aui:option>
                    <%
                        }
                    %>
                </aui:select>
                /
                <aui:select id="birthday_year" name="birthday_year">
                    <aui:option value="0">سال</aui:option>
                    <%
                        String[] yearBirthDay = {"1370","1369","1368","1367","1366","1365","1364"};
                        for(int j=0;j<yearBirthDay.length;j++) {
                    %>
                    <aui:option value="<%=yearBirthDay[j]%>"><%=yearBirthDay[j]%></aui:option>
                    <%
                        }
                    %>
                </aui:select>
            </td>
        </tr>
  </table>
</aui:form>

How can I solve this issue?????? Please guide me.

È stato utile?

Soluzione

<aui:select showEmptyOption="true" name="select hospital name" required="true">

</aui:select>

THis may help you.

Altri suggerimenti

just assign an id to the aui:select tag

<aui:select inlineField="true" label="xxx" name="xxx" id="xxxId">

and then you can get the value with this (javascript + AUI)

var selectedVal = A.one('#<portlet:namespace/>xxxId').val();

with the selected value you can perform any kind of validation.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top