Click to See Complete Forum and Search --> : physically romoving a form element from a page


anarchist
04-09-2003, 09:40 AM
I'm having a problem with submitting a form on a web page that the server side code is slightly buggy(and cant be replaced) I'm able to tell it to exclude an element from the form submission so that its not submitted, however this doesnt always work, someitmes it works 3 times in a row, some times its 20, it seems totally random
so to avoid this problem I've had the bright idea of removing the element from the form enterly and the page for that matter when the form is submitted.
I really want comfirmation that there isnt a simple way like object.destroy() I can call to remove it, rather than use a div tag to enclose it then set the innerhtml to blank to wipe it that way.
all sugestions welcome unless theyre fix the server

and can anyone tell me whats wrong with this line of code?
top.frames['MainEdit'].document.ripper.InnerHTML="hello"
as the function its called from now doesnt work and I cant seem to get ie to give me any errors

gil davis
04-09-2003, 10:09 AM
CaPiTaLiZaTiOn! It's "innerHTML".

anarchist
04-09-2003, 10:22 AM
thanks -wish javascript wasnt case sensitive, I thought thats what it was and that was my first attempt, but it didnt work, must be the other part of it
I've got my div tag that I've named ripper(because it rips some code off the page) if its within a form tag and a table tag do I need to reference the other layers aswell
so it'd be
document.table.form.ripper.innerHTML
or should it work with the more direct access of document.ripper.innerHTML?

gil davis
04-09-2003, 10:29 AM
do I need to reference the other layers aswellThat depends on the browser. For newer W3C DOM compliant browsers you should usewindow.top.frames['MainEdit'].document.getElementById("ripper").innerHTML

anarchist
04-09-2003, 10:39 AM
Thank you Gil,
its finally working, only been working on that page for the last 7 hours

that getElementById's new to me, must have been arround a while though as its working on ie 5

thanks again