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

Update a checkbox on click of a button
Hi there,
I would like "Ready to Convert" checkbox to be checked when a user clicks on CONVERT on Leads. Here is my code:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/12.0/connection.js"></script>
</script>
</head>
<script type="text/javascript">
function btnConvert_Click() {
// First we will make a reference to the CheckBox which is on the LEAD object.
// this is the second choice var chkReady = parent.document.getElementById("chkReady");
var chkReady = parent.document.getElementsByName("Ready_To_Convert__c");
// check if chkReady exists when this function is called.
if (chkReady != null) {
chkReady.checked = true; // check the checkbox.
}
}
<body onLoad="btnConvert_Click();"></body>
</html>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
It gives me this error:-
I would like "Ready to Convert" checkbox to be checked when a user clicks on CONVERT on Leads. Here is my code:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/12.0/connection.js"></script>
</script>
</head>
<script type="text/javascript">
function btnConvert_Click() {
// First we will make a reference to the CheckBox which is on the LEAD object.
// this is the second choice var chkReady = parent.document.getElementById("chkReady");
var chkReady = parent.document.getElementsByName("Ready_To_Convert__c");
// check if chkReady exists when this function is called.
if (chkReady != null) {
chkReady.checked = true; // check the checkbox.
}
}
<body onLoad="btnConvert_Click();"></body>
</html>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
It gives me this error:-
btnConvert_Click is not defined
Another thing, why are you setting the Ready To Convert checkbox when the record is being converted? If you want to see (for reporting purposes) if a Lead has been converted or not, there is an isConverted flag on the Lead natively. I don't know if this will help you, but it may be an easier way around the issue, depending on your business' goal.
Message Edited by jpizzala on 04-14-2008 05:05 PM
Here is the edited version of the code:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/12.0/connection.js"></script>
</script>
</head>
<script type="text/javascript">
function btnConvert_Click() {
// First we will make a reference to the CheckBox which is on the LEAD object.
// this is the second choice var chkReady = parent.document.getElementById("chkReady");
var chkReady = parent.document.getElementsByName("Ready_To_Convert__c");
// check if chkReady exists when this function is called.
if (chkReady != null) {
chkReady.checked = true; // check the checkbox.
}
}
</script>
<body onLoad="btnConvert_Click();"></body>
</html>
It still does not place CHECKMARK on the Ready to Convert box. Why ?
You may be able to accomplish the same thing using workflow or Apex. Is there a specific reason you are attempting this through an scontrol?
Message Edited by jpizzala on 04-16-2008 05:29 PM
Hi,
Try with these lines: -
where 'ABC__c' is the name of the object.
'Generated_A_R_Merge_Document__c' is the name of checkbox field.
Sunil
Message Edited by Sunil on 04-18-2008 01:03 AM
This is now fixed.
Sunil - what is this - Apex or ...?