kburnett
|
| Posted: 06/15/2002, 1:32 PM |
|
has anyone else had a problem with the javascript bind_events function generated by cc studio?
i am simply adding a alert on a delete button.
here's what i did...
selected my delete button
selected events->client->on click->custom code
in the custom code i have added inside of page_sci_status_Delete_OnClick()...
if (!confirm("Are you sure you want to delete this item?"))
{
return false;
}
the javascript generated by cc studio that ties it all together...
function bind_events() {
document.forms["sci_status"].all["Delete"].onclick = page_sci_status_Delete_OnClick;
}
the error that occurs when the page loads...
'document.forms.sci_status.Delete' is null or not an object.
i have verified all spellings and everything looks good. and the code works just fine. except for this error, of course.
anyone have an idea for me?
kyle
|
|
|
 |
Nicole
|
| Posted: 06/17/2002, 11:31 PM |
|
Hello,
I've also ran into this problem. Please try to refer to Delete button by element number, i.e. try the following code instead generated one:
document.forms["form_name"].elements[11].onclick = page_bugs_Delete_OnClick;
where "11" is element number of Delete button (check its number before using).
|
|
|
 |
kburnett
|
| Posted: 06/18/2002, 9:33 AM |
|
niclole,
that is certainly on the right track. two follow-up questions:
1) i am speculating that the item number is determined by javascript when it loads the form?
2) if #1 is true, then i can't count on the delete button to always be the same item number because the delete button only appears on the update view of the page.
thanks again,
kyle
|
|
|
 |
Mark
|
| Posted: 06/25/2002, 1:58 PM |
|
Is there any further feedback on this problem yet ?
Trying to reference the element makes no difference to me, I still get the error message !
Thanks,
Mark
|
|
|
 |
Nicole
|
| Posted: 06/27/2002, 1:57 AM |
|
Hello,
looks like I've found the solution. Open bind_events function in html editor and add code that checked if button exists:
if (document.forms["projects"].all["Delete"]){
document.forms["projects"].all["Delete"].onclick = page_projects_Delete_OnClick;}
instead
document.forms["projects"].all["Delete"].onclick = page_projects_Delete_OnClick;
|
|
|
 |
|