You need to sign in to do that
Don't have an account?
Pass Variable From JavaScript Function on Open.WIndow
I have to pass a string that is a variable of a Javascript function to the new visualforce page controller using open.window. I know you can pass an explicit string value with open.window, like:
var w=window.open('URL?variable=value')
and then use PageReference.getparameters to get the string. However, in mycase, the string comes from a Javascript onclick function, so the string value is known only at run-time. In the code below, I know that getparameters will just provide the string "drilldownparm", instead of the actual value of drilldownparm when the new page is opened. How can I pass the contents of drilldownparm to the new page?
Thanks.
<script type="text/javascript">
function drilldown(drilldownparm) {
var w=window.open('/apex/CompetencyDrillDownPage?testvalue=drilldownparm',target='_blank')
return false
}
</script>
In javascript, you "add" strings together to concatenate. So your URL would be something like:
And you call it from the page like so:
All Answers
In javascript, you "add" strings together to concatenate. So your URL would be something like:
And you call it from the page like so:
That was it. Thanks!
function setLogcallURL(){
var url='/00T/e?title=Call&who_id={!Contact.Id}&retURL=/{!Contact.Id}'
if("{!$Profile.Name}" == "WI" && ("{!$UserRole.Name}"=="AE - E"||"{!$UserRole.Name}"=="AE - W"||"{!$UserRole.Name}"=="AE - S")){
url+='&tsk5=Meeting';
url+='&tsk4={!TODAY()}';
url+='&tsk12=Completed';
url+='&RecordType=0120j0000008dlO';
url+='&ent=Task';
}else if("{!$Profile.Name}" == "WI Corporate Sales") {
url+='&tsk5=Call';
url+='&followup=1';
url+='&tsk4={!TODAY()}';
url+='&RecordType=01250000000HiDD';
url+='&RecordType_fu=01250000000HiDD';
}else{
url+='&followup=1';
url+='&tsk5=Call';
}
window.open(url,"_self");
}
</script>
from vf page:
<apex:commandButton value="Log a Call" onclick="setLogcallURL()" rendered="{!contact.CSG_Status__c == 'Active'}"/>
when i click a button it's reloading the same page and not calling the url
when i change to window.open(url,'_blank'); then it loads the page in seperate tab.
And &tsk4={!TODAY()} it's not the populating the date correctly
it's populating as: Tue Sep 26 00:00:00 GMT 2017 instead 09/26/2017
can you let me know where i am going wrong