Fórum
calculated field
Claudiu Faur, modificado 12 Anos atrás.
calculated field
New Member Postagens: 11 Data de Entrada: 28/05/11 Postagens Recentes
Hello,
Is there a way to display the sum of two <aui:input> fields in a another <aui:input> without submitting the form ?
Is there a way to display the sum of two <aui:input> fields in a another <aui:input> without submitting the form ?
Sandeep Nair, modificado 12 Anos atrás.
RE: calculated field
Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Yes, just add the onChange attribute in both the <aui:input tags and call a javascript function there which would update the value of the third input. pseudo code would be something like below
<aui:input name="value1" onChange="<portlet:namespace/>addThis()"/>
<aui:input name="value2" onChange="<portlet:namespace/>addThis(t)"/>
<aui:input name="result" onChange="<portlet:namespace/>addThis(t)"/>
<script>
<portlet:namespace/>addThis(){
//do your logic to add the value of two text box and set the value in result.
}
</script>
Regards,
Sandeep
<aui:input name="value1" onChange="<portlet:namespace/>addThis()"/>
<aui:input name="value2" onChange="<portlet:namespace/>addThis(t)"/>
<aui:input name="result" onChange="<portlet:namespace/>addThis(t)"/>
<script>
<portlet:namespace/>addThis(){
//do your logic to add the value of two text box and set the value in result.
}
</script>
Regards,
Sandeep