You need to sign in to do that
Don't have an account?
kevindotcar
Problem setting values on a VF page via Javascript
Hi all,
I'm trying to build a custom button on a page layout for a custom object that calls javascript that updates other fields on the page. I defined the behavior as "execute javascript" and the Content Behavior as "OnClick Javascript". The source is simple;
<script language="JavaScript">
try { {!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} {!Appointment__c.Confirmed_Date__c}={!Appointment__c.ApptDate__c} ; {!Appointment__c.Confirmed_Time__c}={!Appointment__c.ApptTime__c} ; } catch(err){ alert(err); }
</script>
...But I keep on getting a popup that says "syntax error" - help?
Hi Hemantgarg,
You are absolutely correct.
This is the code that worked:
...I guess I was under-thinking the problem :-)
All Answers
Hey
i've not used that feature of SF a lot, so I can't comment on your js code (i think the merged fields will only enable you to read a value). But you don't need the <script> tags, just put your js code in that box and it should run.
Hi,
if the button type is "Execute javascript", then there is no need to enclose the "<script>" tag. If it still not solve your problem then
Change declaration from
to
OR
because your script decalarion is not valid.
I think it does not work in this way. You have to create an instance of the object and update the values in database using AJAX api. this way you can not assign/update values in a record.
Hi Hemantgarg,
You are absolutely correct.
This is the code that worked:
...I guess I was under-thinking the problem :-)