N
Navillus
Hey gang,
I'm helping this guy with his company's website. They have a page where
you login, and basically it looks like when you enter your password and
user info and submit the form, it runs a javascript function that saves
the info as a cookie. It looks like this:
<script language="JavaScript">
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";
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= /';
}
</script>
They want to make it so that when you register, which is on a different
page, you can automatically be logged in. I tried doing this by copying
the saveCookie function into the final page of the registeration
process, and changing the variables accordingly. This is where it gets
fishy, because there's a lot of SAP in the registration form. Here's my
savecookie function from the registration page:
<script language="JavaScript">
function savecookie()
{
/* save the values of user and password of the form input in the cookie
*/
var url = "/sap/its/iacproject/select_premises.html";
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() + 1);
document.cookie = 'password=
EWEBIAC_HTML_LOGIN_FIELDS-alias_name_RES.value; path= /';
document.cookie = 'user=
EWEBIAC_HTML_LOGIN_FIELDS-PASS_RES.value; expires=' +
nextyear.toGMTString() +'; path= /';
}
savecookie();
</script>
Now, it's almost working. It does save the cookie for me, but the
values are all messed up. I think I have a syntax error in assigning
the cookie variables. I'm hoping it's just a few quotation marks or
something that someone here can identify for me. I assign the variables
like this because of how the SAP looks below:
<body `SAP_BodyAttributes()` onLoad="`SAP_OnLoadJavaScript()`">
`SAP_TemplateFormBegin()`
<h2 style="font-style:arial" style="font-size:24pt">`#l_header`</h2>
`SAP_TemplateGroupBoxBegin( groupboxlabel=#success)`
`SAP_TemplateInfoLine(~messageline)`
<br>
`SAP_TemplateNonEditableField("alias_name_RES",
fieldLabel=fieldLabel=#alias_name,
fieldLabelWidth="250",value=EWEBIAC_HTML_LOGIN_FIELDS-alias_name_RES.value,size="150")`
<br>
`SAP_TemplateNonEditableField("PASS_RES",
fieldLabel=EWEBIAC_HTML_LOGIN_FIELDS-PASS_RES.label,
fieldLabelWidth="250",value=EWEBIAC_HTML_LOGIN_FIELDS-PASS_RES.value,size="20")`
<br>
`SAP_TemplateNonEditableField("smtp",
fieldLabel=EWEBIAC_HTML_LOGIN_FIELDS-smtp.label,
fieldLabelWidth="250",value=EWEBIAC_HTML_LOGIN_FIELDS-smtp.value,size="100")`
<script language="JavaScript">
savecookie();
</script>
.....
<snip>
anyone have an idea of how I can get the variables passed from the
previous form into the cookie? Thanks!
I'm helping this guy with his company's website. They have a page where
you login, and basically it looks like when you enter your password and
user info and submit the form, it runs a javascript function that saves
the info as a cookie. It looks like this:
<script language="JavaScript">
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";
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= /';
}
</script>
They want to make it so that when you register, which is on a different
page, you can automatically be logged in. I tried doing this by copying
the saveCookie function into the final page of the registeration
process, and changing the variables accordingly. This is where it gets
fishy, because there's a lot of SAP in the registration form. Here's my
savecookie function from the registration page:
<script language="JavaScript">
function savecookie()
{
/* save the values of user and password of the form input in the cookie
*/
var url = "/sap/its/iacproject/select_premises.html";
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() + 1);
document.cookie = 'password=
EWEBIAC_HTML_LOGIN_FIELDS-alias_name_RES.value; path= /';
document.cookie = 'user=
EWEBIAC_HTML_LOGIN_FIELDS-PASS_RES.value; expires=' +
nextyear.toGMTString() +'; path= /';
}
savecookie();
</script>
Now, it's almost working. It does save the cookie for me, but the
values are all messed up. I think I have a syntax error in assigning
the cookie variables. I'm hoping it's just a few quotation marks or
something that someone here can identify for me. I assign the variables
like this because of how the SAP looks below:
<body `SAP_BodyAttributes()` onLoad="`SAP_OnLoadJavaScript()`">
`SAP_TemplateFormBegin()`
<h2 style="font-style:arial" style="font-size:24pt">`#l_header`</h2>
`SAP_TemplateGroupBoxBegin( groupboxlabel=#success)`
`SAP_TemplateInfoLine(~messageline)`
<br>
`SAP_TemplateNonEditableField("alias_name_RES",
fieldLabel=fieldLabel=#alias_name,
fieldLabelWidth="250",value=EWEBIAC_HTML_LOGIN_FIELDS-alias_name_RES.value,size="150")`
<br>
`SAP_TemplateNonEditableField("PASS_RES",
fieldLabel=EWEBIAC_HTML_LOGIN_FIELDS-PASS_RES.label,
fieldLabelWidth="250",value=EWEBIAC_HTML_LOGIN_FIELDS-PASS_RES.value,size="20")`
<br>
`SAP_TemplateNonEditableField("smtp",
fieldLabel=EWEBIAC_HTML_LOGIN_FIELDS-smtp.label,
fieldLabelWidth="250",value=EWEBIAC_HTML_LOGIN_FIELDS-smtp.value,size="100")`
<script language="JavaScript">
savecookie();
</script>
.....
<snip>
anyone have an idea of how I can get the variables passed from the
previous form into the cookie? Thanks!