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
Cristian TrifCristian Trif 

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?

abhishek singh 497abhishek singh 497
Hello Christian,

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
Cristian TrifCristian Trif
You confused me more... shit.