Foros de discusión
In alloy-ui how to validate select field....
Ramya Sree Kalagiri, modificado hace 11 años.
In alloy-ui how to validate select field....
New Member Mensajes: 8 Fecha de incorporación: 19/12/12 Mensajes recientes
Hi all,
how to validate select field as mandatory only when it's corresponding text field is entered?
For example
<aui:form name="temp">
<aui:input type="text" name="temperature"/>
<aui:select label="" name="unit">
<aui:option value="" >--select--</aui:option>
<aui:option value="hello">Celcius</aui:option>
<aui:option value="hello hi">Fahrenheit </aui:option>
</aui:select>
<aui:input type="submit" name="submit"/>
</aui:form>
Here using alloy-ui validations how to generate validation error when temperature is entered but unit has not chosen?
Note:It is not mandatory that always temperature should be entered
can any please help me out.....
how to validate select field as mandatory only when it's corresponding text field is entered?
For example
<aui:form name="temp">
<aui:input type="text" name="temperature"/>
<aui:select label="" name="unit">
<aui:option value="" >--select--</aui:option>
<aui:option value="hello">Celcius</aui:option>
<aui:option value="hello hi">Fahrenheit </aui:option>
</aui:select>
<aui:input type="submit" name="submit"/>
</aui:form>
Here using alloy-ui validations how to generate validation error when temperature is entered but unit has not chosen?
Note:It is not mandatory that always temperature should be entered
can any please help me out.....
Hitoshi Ozawa, modificado hace 11 años.
RE: In alloy-ui how to validate select field....
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Check the following page to see form validation with alloy ui.
http://rajeevalochanabr.wordpress.com/2012/08/20/validation-using-auialloy-user-interface-script-and-html-form/
http://rajeevalochanabr.wordpress.com/2012/08/20/validation-using-auialloy-user-interface-script-and-html-form/
Ramya Sree Kalagiri, modificado hace 11 años.
RE: In alloy-ui how to validate select field....
New Member Mensajes: 8 Fecha de incorporación: 19/12/12 Mensajes recientes
Hi,
thank you for the reply. I know how to validate select as required. But I want to know how validation on select will be done only when the text field(temperature) is entered.
thank you for the reply. I know how to validate select as required. But I want to know how validation on select will be done only when the text field(temperature) is entered.
Ramya Sree Kalagiri, modificado hace 11 años.
RE: In alloy-ui how to validate select field....
New Member Mensajes: 8 Fecha de incorporación: 19/12/12 Mensajes recientes
Can any one please solve my question soon? I need it urgently.... thanks in advance.
Joe Pinto, modificado hace 9 años.
RE: In alloy-ui how to validate select field....
New Member Mensajes: 4 Fecha de incorporación: 21/02/14 Mensajes recientes
I may be a little late here...
try to think it like this:
instead of saying 'this field is always required' like in 'required: true' you should say 'this field is required when temperature is set'
please be aware i'm using jQuery in my answer to get the value of the temperature field.. plus,
try to think it like this:
instead of saying 'this field is always required' like in 'required: true' you should say 'this field is required when temperature is set'
function isTemperatureSet(){
if( $('#temperature').val() != ""){
return true;
}
return false;
}
var rules = {
<portlet:namespace />unit: {
required: isTemperatureSet
}
};
please be aware i'm using jQuery in my answer to get the value of the temperature field.. plus,
if( $('#temperature').val() != "")
does not work for whitespaced strings, etc