Thursday, June 24, 2010

Tips for the components(inputtextfields,inputtextarea etc) in JSF

In jsp write the following javascript function under script tag
<script type="text/javascript">
function tipsMsg (val)
{
document.getElementById("msg").innerHTML = '';
if ( "tf_user_no1" == val )
{
document.getElementById("msg").innerHTML = 'User Number1 should be [a-z,A-Z,0-9]';
}
else if ( "tf_user_no2" == val )
{
document.getElementById("msg").innerHTML = 'User Number2 should be [0-9]';
}
}
</script>

call the above function in the following way
<h:inputText id="tf_USER_NO1" size="6" binding="#{printcheckdetails.tf_USER_NO1}" onkeyup="makeCaps('tf_USER_NO1')" onfocus="javascript:tipsMsg('tf_user_no1')" autocomplete="off" maxlength="6"/>

<h:inputText id="tf_USER_NO2" size="4" binding="#{printcheckdetails.tf_USER_NO2}" autocomplete="off" onfocus="javascript:tipsMsg('tf_user_no2')" onblur="formatNubmerPart(4)" maxlength="4"/>

if we put cursor in the userNumber text field it will give the message

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

No comments:

Post a Comment