Foros de discusión

RE: aui:validator support for aui:select

thumbnail
Walter Christian Guardia Casas, modificado hace 11 años.

RE: aui:validator support for aui:select

Regular Member Mensajes: 127 Fecha de incorporación: 5/05/10 Mensajes recientes
Hello,

I did it but with Liferay 6.1 EE, the piece of code is:


<aui:fieldset>
<div style="width:48%; position:relative; float:left;">
<aui:select label="driver-profesion" name="driverProfesion">
<aui:option value="">-- Seleccione --</aui:option>
<aui:option value="201">Abogados</aui:option>
<aui:option value="371">Pintores</aui:option>
<aui:option value="263">Psicologos</aui:option>
</aui:select>
</div>
</aui:fieldset>

<aui:script use="aui-form-validator, aui-overlay-context-panel">


var validator1 = new A.FormValidator({
boundingBox: document.<portlet:namespace/>fm,

rules: {
<portlet:namespace/>vehicleModel: {
required: true
},
<portlet:namespace/>driverSex: {
required: true
},
<portlet:namespace/>driverProfesion: {
required: true
},
<portlet:namespace/>driverState: {
required: true
},
'<portlet:namespace/>newVehicle': {
required: true
}
},

fieldStrings: {
<portlet:namespace/>vehicleModel: {
required: '<liferay-ui:message key="required-selected-model-car" />'
},
'<portlet:namespace/>newVehicle': {
required: '<liferay-ui:message key="required-selected-is-new-car" />'
}
}
})


</aui:script>


Regards
Raj Kumar Kulasekaran, modificado hace 11 años.

RE: aui:validator support for aui:select

New Member Mensajes: 17 Fecha de incorporación: 19/04/12 Mensajes recientes
Hi,

Thanks for your reply.

It worked for me emoticon.

I was trying using the tag directly which was giving me null pointer exception
I was using like

<aui:select showEmptyOption="true" name="Name" label="Name">
<aui:option label="n1" value="n1"></aui:option>
<aui:option label="n2" value="n2"></aui:option>
<aui:validator name="required"/>
</aui:select>


With the format which you provided it works fine.
thumbnail
Robin Nagpal, modificado hace 9 años.

RE: aui:validator support for aui:select

Junior Member Mensajes: 44 Fecha de incorporación: 18/11/14 Mensajes recientes
Add required attribute like

         <aui:select label="age" name="ageRange" required="true">
                <aui:option label="select-age-range" value="" />
                <aui:option label="under-18" value="UNDER_18" />
                <aui:option label="18-34" value="EIGHTEEN_TO_THIRTY_FOUR" />
                <aui:option label="35-54" value="THIRTY_FIVE_TO_FIFTY_FOUR" />
                <aui:option label="55-74" value="FIFTY_FIVE_TO_SEVENTY_FOUR" />
                <aui:option label="75-above" value="SEVENTY_FIVE_AND_ABOVE" />
            </aui:select>
thumbnail
Marouen OUESLATI, modificado hace 9 años.

RE: aui:validator support for aui:select

New Member Mensajes: 5 Fecha de incorporación: 4/06/13 Mensajes recientes
Robin Nagpal:
Add required attribute like

         <aui:select label="age" name="ageRange" required="true">
                <aui:option label="select-age-range" value="" />
                <aui:option label="under-18" value="UNDER_18" />
                <aui:option label="18-34" value="EIGHTEEN_TO_THIRTY_FOUR" />
                <aui:option label="35-54" value="THIRTY_FIVE_TO_FIFTY_FOUR" />
                <aui:option label="55-74" value="FIFTY_FIVE_TO_SEVENTY_FOUR" />
                <aui:option label="75-above" value="SEVENTY_FIVE_AND_ABOVE" />
            </aui:select>



Hi,

Do you know know how to customize the required-Error message?

Thanks.
thumbnail
Aravinth Kumar, modificado hace 9 años.

RE: aui:validator support for aui:select

Regular Member Mensajes: 152 Fecha de incorporación: 26/06/13 Mensajes recientes
Hi,
You can use error message attribute.

Refer this link for aui validators
http://www.liferaysavvy.com/2013/12/liferay-aui-validator.html
thumbnail
Asif Billa, modificado hace 8 años.

RE: aui:validator support for aui:select

New Member Mensajes: 15 Fecha de incorporación: 4/05/15 Mensajes recientes
Hi Robin,

The code looks fine, But can You please explain how to get the selected value in Portlet****.java class.

Suppose I have selected the age range from 18-35, If I use the same data to print in console or store in DB, how do I do that. I mean how do I get the selected value in my business class.
thumbnail
Jan Geißler, modificado hace 8 años.

RE: aui:validator support for aui:select

Liferay Master Mensajes: 735 Fecha de incorporación: 5/07/11 Mensajes recientes
By understanding basic Web technologies (Like Request/Response), the portlet lifecicle, and what happens when in a portlet.
thumbnail
Asif Billa, modificado hace 8 años.

RE: aui:validator support for aui:select

New Member Mensajes: 15 Fecha de incorporación: 4/05/15 Mensajes recientes
Ya, I got it.

Thanks Jan emoticon