You need to sign in to do that
Don't have an account?
Access one VF page data from another VF page
Hi,
I have created one VF page (Name: vfPageOne) and having my controller to populate data for that VF page. I have defined the "contentType="text/javascript"" for the VF page so that I can include this VF page into another VF page.
I have create another VF page (Name: vfPageTwo) and including 'vfPageOne' into this second VF page.
Here is my code snippet of 'vfPageOne' is.
#*******************************************
<apex:page controller="ctrlOne" contentType="text/javascript">
<script>
var srchInput = {!srchData}; // {!srchData} is coming from controller in JSON format.
alert({!srchData});
</script>
</apex:page>
#*******************************************
Here is my code snippet of 'vfPageTwo' is.
#*******************************************
<apex:page controller="ctrlTwo">
<apex:includeScript value="apex/PPF_SearchKeywords"/>
<script>
alert(srchInput);
</script>
<apex:form >
<apex:inputText value="{!srchKeyword}" id="srchbox1"/>
</apex:form>
</apex:page>
#*******************************************
I am trying to access js variable 'srchInput' from 'vfPageTwo' which got populated in 'vfPageOne'. In 'vfPageTwo', i could see the values. But in VF page two, alert() is saying undefined for 'srchInput'. I could have done away with one vf page and controller, but I want to reduce the viewstate size of second VF page.
Let me know how I can achieve this.