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

document.getElementById
How to call inputfield value which is in page block from javascript.
function test()
{
var end_date=document.getElementById(ttt);
}
<apex:column headerValue="Value1" id="e">
<apex:inputfield id="ttt" value="{!Is_rate}" >
</apex:inputfield>
Its not very clear on what you want, but if you are trying to ask how to call you js function test, you can do that using onchange
<apex:inputfield id="ttt" value="{!Is_rate}" onchange="test();" >
</apex:inputfield>
i want to display visualforce page value in a alert box.
i.e value of input field where its id="ttt" , this value should be displayed in a alert box. on any events..
Hi,
You have to mention either the entire path inside the document.getElementbyId like below:
1. <script> var theText = document.getElementById(“pageid:formid:ttt”); </script>
2. Or you can use Global variable Component like below:
<script> var theText = document.getElementById(“{!$Component.theText}”); </script>
You can simply do that by using alert inline
<apex:inputfield id="ttt" value="{!Is_rate}" onkeyup="alert(this.value);" >
</apex:inputfield>
if you want just on change
<apex:inputfield id="ttt" value="{!Is_rate}" onchange="alert(this.value);" >
</apex:inputfield>
<apex:inputfield id="ttt" value="{!Is_rate}" ></apex:inputfield>
function test()
{
var end_date=document.getElementById("{!$Component.ttt}");
}
alert('end_date'+end_date);
It Will Work,Let me know it solved your problem
You use the below code for your problem.
In case you find any other issue please mention.
If you find your Solution than mark as this as a best answer.
Thanks and Regards
Suraj Tripathi.