Skip to Content
author's profile photo Former Member
Former Member

What am I missing? javascript document.forms question...

I am getting an error "document.forms.logoffForm is null or not an object".

My code is:

<script language="JavaScript">

function logoff()

{

EPCM.raiseEvent("urn:com.sapportals.portal:user", "logoff", "");

document.forms["logoffForm"].submit();

//document.forms[1].submit();

}

<hbj:content id="myContext" >

<hbj:page title="myCAreports">

<hbj:form id="myFormId" method="post" action="">

.

.

.

</hbj:form>

</hbj:page>

</hbj:content>

<form name="logoffForm" style="display:none" action="<%=GetLogoffURL(componentRequest)%>" method="POST">

<input type="hidden" name="logout_submit" value="true"></input>

</form>

If I view the source, I can SEE the form.

But...

too debug I put this in my javascript function:

<b>var forms;

forms = document.forms.length;

alert("# of forms = " + forms.toString());</b>

The alert showed "# of forms = 0".

Why?

I pretty much took this code from HeaderiView.jsp from the Masthead par.

Heck, the masthead works. Why am I getting my error?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 12, 2004 at 01:25 PM

    Could you send the generated HTML from this code ?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.