Forum

Accueil » Alloy UI » English

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Liferay Krrishna
Validations for AUI Select, Radio and CheckBoxes..
26 août 2014 22:17
Réponse

Liferay Krrishna

Rang: Junior Member

Publications: 25

Date d'inscription: 19 décembre 2013

Publications Récentes

Hi all,

I am able to do validations for AUI Input Fileds, but i am failing in Validate the AUI Select, Radio and Check Boxes in a form.
Test code:
//working code for input fields
<aui:input name="name" id="name" label="Topic Name" > >
<aui:validator name="required" errorMessage="Name is required"/>
<aui:validator name="alphanum" />
<aui:validator name="minLength">5</aui:validator>
<aui:validator name="maxLength">70</aui:validator>
</aui:input>
//not working
<aui:select id="parentId" name="parentId" label="Parent Id" >
<aui:option value="0" label="Select Parent Topic" />
<aui:option value=" 2" label=""abc" />
<aui:option value="1" label="zxc" />

<aui:validator name="custom" errorMessage="Please Select Topic Parent" >
function (val, fieldNode, ruleValue) {
var result = false;
var selectedVal = A.one('#<portlet:namespace/>parentId').val();
alert(selectedVal);
if (selectedVal == 0) {

result = false;
}
return result;
}
</aui:validator>
</aui:select></p>

when i use that AUI:validator for Select tags i am getting error like following:
org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet topicDetail Servlet threw exception
java.lang.NullPointerException
at com.liferay.taglib.aui.ValidatorTagImpl.doEndTag(ValidatorTagImpl.java:82)
at org.apache.jsp.TopicsPortlet.topicDetail_jsp._jspx_meth_aui_005fvalidator_005f0(ABC_jsp.java:779)
at org.apache.jsp.TopicsPortlet.topicDetail_jsp._jspx_meth_aui_005fselect_005f0(ABC_jsp.java:637)
at org.apache.jsp.TopicsPortlet.topicDetail_jsp._jspx_meth_aui_005ffieldset_005f0(ABC_jsp.java:561)

Pls Let me any solution, its urgent..
Pls share working code..


Thanks In Advance:
Manali Lalaji
RE: Validations for AUI Select, Radio and CheckBoxes..
26 août 2014 22:54
Réponse

Manali Lalaji

Rang: Expert

Publications: 362

Date d'inscription: 9 mars 2010

Publications Récentes

Hi,

Can you try below code for aui:select ? You can customize code according to your requirements.

 1<aui:form action="/abc" method="post" name="form">
 2           <aui:select label="" id="SimpleTermDropDown" name="SimpleTermDropDown" >
 3                           <aui:option selected="true" value=""><liferay-ui:message key="Choose a Data Type" /></aui:option>
 4                          <aui:option value="integer"><liferay-ui:message key="Integer" /></aui:option>
 5                            <aui:option value="long"><liferay-ui:message key="Long" /></aui:option>
 6                           <aui:option value="string"><liferay-ui:message key="String" /></aui:option>
 7           </aui:select>
 8           <br/><br/><aui:button cssClass="save" value="Save" type="Submit"></aui:button>
 9 </aui:form>
10
11<script type="text/javascript" charset="utf-8">
12 AUI().ready('alloy-node','aui-form-validator', function(A) {
13   
14     validator2 = new A.FormValidator({
15        boundingBox: document.<portlet:namespace/>form,
16        rules: {    
17              <portlet:namespace />SimpleTermDropDown: {
18                  required: true
19             }
20        },
21       fieldStrings: {
22             <portlet:namespace />SimpleTermDropDown: {
23                required: 'Select dropdown value'
24             }
25         },
26       on: {
27             validateField: function(event) {
28            },
29            validField: function(event) {
30            },
31            errorField: function(event) {
32            },
33             submitError: function(event) {
34                var formEvent = event.validator.formEvent;
35                var errors = event.validator.errors;
36                 event.preventDefault();
37             },
38             submit: function(event) {
39                     var formEvent = event.validator.formEvent;
40                    return false;
41             }
42         }
43   });
44 });
45
46</script>



HTH!
Liferay Krrishna
RE: Validations for AUI Select, Radio and CheckBoxes..
26 août 2014 23:35
Réponse

Liferay Krrishna

Rang: Junior Member

Publications: 25

Date d'inscription: 19 décembre 2013

Publications Récentes

Thank So much Manali .. i did the same thing but i missed to take <portlet:namespace> any way thanks again:
and one Quick Question do u have any working experience on Solr and Liferay Integartion. we are using liferay tomcat ce GA3 (6.1.2)..
Manali Lalaji
RE: Validations for AUI Select, Radio and CheckBoxes..
27 août 2014 01:02
Réponse

Manali Lalaji

Rang: Expert

Publications: 362

Date d'inscription: 9 mars 2010

Publications Récentes

Hi,

You can search out several links available for Solr Integration with Liferay. Refer link1, link2

HTH!