function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neeedhelpneeedhelp 

Month validation in javascript

Hi all,

 

  if the month was less than today then I should show an error message through javascript in visualforce page.......I have tried but unable to...here is my code

 

/*javascript*/
if(exm < Month(today())) { condition=1; alert("Invalid month"); jQuery(".exm").focus(); return false; } /* page */ <apex:selectlist value="{!Item.ExpirationMonth}" size="1" styleclass="exm" > <apex:selectOptions value="{!item.ExpireMonth}"/> </apex:selectlist> /* in constructor */ string dd=datetime.now().format('MM/dd/yyyy'); string mon=dd.substring(0,2); string year=dd.substring(7,10); item.ExpirationMonth=mon;

 

AmitSahuAmitSahu
Where is the JScript method ?
neeedhelpneeedhelp

 

 

<script type="text/javascript">
function monthvalidate(){
if(exm < Month(today())) { condition=1; alert("Invalid month"); jQuery(".exm").focus(); return false; }
}
</script>

This function I'm calling in Command button.....So whenever I perform an action it is called automatically...