Navillus said:
Here's the jist of what I got so far. Something is still tripping it up
so it can't submit:
<script language="JavaScript">
The language attribute is (still) deprecated, type is required.
function savecookie()
{
/* save the values of user and password of the form input
(document.form.elementname) in the cookie */
var url = "/sap/its/iacproject/select_premises.html";
The 'url' variable is not used - is it supposed to be?
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() + 1);
document.cookie = 'password= '+ document.Login.password.value +
'# expires='+ nextyear.toGMTString() +'; path= /';
document.cookie = 'user= '+ document.Login.user.value + ';
expires=' + nextyear.toGMTString() +'; path= /';
Don't let your code auto-wrap. Manually wrap at about 70 characters or
errors like this are introduced.
From what you have posted, the value of 'user' will be - `usr` - and
the value of password will be - `pss` - always (presuming that the form
does actually auto-submit). I don't think that is what is intended.
You don't appear to ever get values for user and password from the
cookie (or anywhere else) to put into the form.
}
function autoSubmit(){
document.Login.submit();
}
</script>
</head>
<body `SAP_BodyAttributes()` onload="`SAP_OnloadJavaScript()`">
That is invalid HTML. `SAP_BodyAttributes()` is an attribute value with
no name. You are feeding onload a string literal, whereas it requires a
function call or script statements. The above also causes illegal
character errors in Firefox unless the ` character is replaced with '.
I get the feeling this is sever code that you are trying to generate
client code from.
<form name="Login" action="">
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<br>
<br>
<tr>
<td width=5%></td>
<td>
<table border=0 cellpadding=2 cellspacing=2>
<tr>
<td align=right class=label>`#LoginID`
</td>
<td align=left>
<input type=text maxlength="40" size="40" name="user"
value="`usr`">
The input has a value of the string literal `usr`. Nothing you have
posted shows how any other value might get in there.
</td>
</tr>
<tr>
<td align=right class=label>`#Password`
</td>
<td align=left>
<input type=password maxlength="8" name="password" value="`pss`">
The input has a value of the string literal `pss`. Nothing you have
posted shows how any other value might get in there.
</td>
</tr>
<tr>
<td></td>
<td>
<input type=image name="~OkCode(LGON)"
Weird name, looks more like a function call.
SRC="`mimeURL(~name="button/login.gif")`" border=0
More invalid HTML with incorrect nesting of quotes.
onclick="savecookie();">
</td>
</tr>
</table>
`if (~messageline != "")`
Is this supposed to be displayed in the page? More server code?
<table border=0>
<tr>
<td align=center class=message>`~messageline`
More server code?
</td>
</tr>
</table>
`end`
Ditto.
</td>
</tr>
</form>
<script language="JavaScript">
The language attribute is (still) deprecated, type is required.
var testUser = `usr`;
if (testUser != "")
Considering that you initialise testUser with a string literal, this
test will *always* be false. I suspect that the server is supplying a
value for `usr`.
{
savecookie(); <-- not sure if I should call this function, which
the normal form seems to do
Calling savecookie() makes no difference at all (I'll guess that the
comment is there only for posting, it will cause an error if it's in the
actual source).
autoSubmit(); <-- or this guy right here, neither seem to work
This will do nothing. The submit function (as posted previously) is:
function autoSubmit()
{
document.form.submit();
}
There is no form called 'form', the one you want to submit is called
'Login'. You should allow the form name to be passed to autosubmit() or
just call submit from here:
document.forms['Login'].submit();
But given the stuff above, if that does work (it will never be called at
present because the if test always fails) the page will continuously
submit itself in a never-ending loop.
}
</script>
<script> document.Login.user.focus(); </script>
<p>
</p>
</body>
</html>
Now, there's some wierd SAP variable stuff in there, but trust me, when
the previous form sends the variable 'usr', calling `usr` puts it in
there correctly. It doesn't seem to matter though. I've tried like 5
different ways to test to see if usr exists, and none of them seem to
work. In fact, even if I just do something like if (1), it still won't
automatically submit. Well, it did once, but only when there wasn't a
value of usr. I'm thinking something like the <script>
document.Login.user.focus(); </script> is preventing it from
auto-submitting.
Unlikely. If the script works then the form will be submitted before
that line is reached. If the form isn't submitted, then focus is put
onto the 'user' input.
Nor do I. Seems to me you are posting what you think the browser is
getting based on munged server code (but maybe that's wrong). Use your
browser's view source function to get the actual code received at the
client, then you might have a chance of making it work.
Otherwise little more help can be provided unless someone understands
what should be happening with your server code.