Forums de discussion
In alloy-ui how to validate select field....
Ramya Sree Kalagiri, modifié il y a 11 années.
In alloy-ui how to validate select field....
New Member Publications: 8 Date d'inscription: 19/12/12 Publications récentes
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, modifié il y a 11 années.
RE: In alloy-ui how to validate select field....
Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
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, modifié il y a 11 années.
RE: In alloy-ui how to validate select field....
New Member Publications: 8 Date d'inscription: 19/12/12 Publications récentes
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, modifié il y a 11 années.
RE: In alloy-ui how to validate select field....
New Member Publications: 8 Date d'inscription: 19/12/12 Publications récentes
Can any one please solve my question soon? I need it urgently.... thanks in advance.
Joe Pinto, modifié il y a 9 années.
RE: In alloy-ui how to validate select field....
New Member Publications: 4 Date d'inscription: 21/02/14 Publications récentes
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