You need to sign in to do that
Don't have an account?
Dream_weaver
How to fetch a live value from a input field before saving the data?
I have a input field-- <apex:inputField value="{!Registration__c.Event__c}" label="Event" id="Event" />
Now i want to fetch the field value before saving the data into database..
I have called a JScript on clicking of save button..
function Check()
{
var data=document.getElementById('page:form:block:section:Event');-->differenrt page level ids
alert("Do you want to register for "+data.value.name+"?");
}
But it is returning "Undefined" !!! I think it is because the data is not saved yet! Please guide...
Hi,
do this ..................
function Check()
{
var data=document.getElementById('page:form:block:section:Event');
alert("Do you want to register for "+data.value+"?");
}
put data.value in place of data.value.name..
Thanks
I have tried this before but if I put data.value then the alert msg itself not working!! Dont know WHY!!!!!
check this error in inspect element of browser.
Hi ,
This should help you,
function check()
{
var data =document.getElementById('{!$Component.event}').value;
alert("Do you want to register for "+data+"?");
}
If you have event inside any other component, then try step by step accessing.
For example, to access a data table withid="tableID"contained in a page block withid="blockID", use the following expression:$Component.blockID.tableID.
Checkout this LINK for more details.
Please mark this post as solved, if it helps you
-----------------------------------------
code which i checked, copy & paste in a separate page and try it
<apex:page standardController="Opportunity">
<apex:form id="myform" >
<script>
function check()
{
var test =document.getElementById('{!$Component.order}').value;
alert(test);
}
</script>
<apex:commandButton value="save" onclick="javascript:check()"/>
<apex:inputField value="{!Opportunity.OrderNumber__c}" id="order"/>
</apex:form>
</apex:page>
pass anyone Opportunity SFDC Id in the parameter, like apex/testPage?Id=006U000000262zY
----------------------------------
Regards,
Bharathi
Salesforce For All