You need to sign in to do that
Don't have an account?

Pass my fieldInput ID to a function
So I have the inputField:
<apex:inputField id="timeLimiter" value="{!pageForm.currentContract.ContractingVehicleRegistrationDate__c}" rendered="{!NOT(contractFieldReadOnlyRegistrationDate)}"/>
This is my inputField with the id='timeLimiter' and I want to use my function only for this field.
My function is:
<script type="text/javascript"> $j(document).ready(function () { var today = new Date(); var startYear=today.getFullYear()-19; var endYear=today.getFullYear(); var optionsString=''; if(startYear<endYear){ for(var startCounter = startYear;startCounter<endYear; startCounter++){ optionsString += "<option value=\""+startCounter+"\">"+startCounter+"</option>"; } $j('#calYearPicker').html(optionsString);} }); </script>
The thing is I want my function to only apply to this field because in my form I have multiple fields of the same type(Date) and this function applies to all my fields(which I don't want ).
How can I pass my id from my field to my function?
Below code might help you and you can modify your code as per your need.
<apex:InputField id="textbox2maybe" onchange="javascript:onStipulationReasonChange(this);" value="{!stipObj.Stipulation_Reason__c}" /> <script>
function onStipulationReasonChange(el)
{ if(el.value.length > 0)
{
$('#savebutton3').show();
}
else
{
$('#savebutton3').hide();
}
}
</script>
Please let me know for any concerns further.
Thanks & Regards,
Abhishek Singh