You need to sign in to do that
Don't have an account?
Sravani SB
error meage using jquery or javascript
$(document).on('click','.f',function(){
alert('Happy New Year');
var status1 = $('.b').val();
alert('status'+status1);
if(status1=="open") {
alert('status'+status1);
$('.b').text("Status Field Should not be Open");
}
});
<apex:commandButton value="Save" action="{!save1}" styleClass="f"/>
<apex:inputField value="{!a.Status__c}" styleClass="b"/>
alert('Happy New Year');
var status1 = $('.b').val();
alert('status'+status1);
if(status1=="open") {
alert('status'+status1);
$('.b').text("Status Field Should not be Open");
}
});
<apex:commandButton value="Save" action="{!save1}" styleClass="f"/>
<apex:inputField value="{!a.Status__c}" styleClass="b"/>
All Answers
You can use apex:pageMessage to display the individual message on VF page
This is a kind of static message which you will write in Visualforce itself and can put some conditions in rendered attribute to display the message. This would render to
severity can be anything from 'confirm', 'info', 'warning', 'error'.
This will render below html code Html Id can vary according to your code.
You can easily manipulate this code using jQuery and HTML Id. For more information please refer to below link.
- http://www.sfdcpoint.com/salesforce/apexpagemessage-and-apexpagemessages-salesforce/
Hope this helps.Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra