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="JavaS cript">
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.setFul lYear(nextyear. getFullYear() + 1);
document.cookie = 'password= '+ document.Login. password.value +
'# expires='+ nextyear.toGMTS tring() +'; path= /';
document.cookie = 'user= '+ document.Login. user.value + ';
expires=' + nextyear.toGMTS tring() +'; 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="JavaS cript">
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.setFul lYear(nextyear. getFullYear() + 1);
document.cookie = 'password=
EWEBIAC_HTML_LO GIN_FIELDS-alias_name_RES. value; path= /';
document.cookie = 'user=
EWEBIAC_HTML_LO GIN_FIELDS-PASS_RES.value; expires=' +
nextyear.toGMTS tring() +'; 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_BodyAttrib utes()` onLoad="`SAP_On LoadJavaScript( )`">
`SAP_TemplateFo rmBegin()`
<h2 style="font-style:arial" style="font-size:24pt">`#l_ header`</h2>
`SAP_TemplateGr oupBoxBegin( groupboxlabel=# success)`
`SAP_TemplateIn foLine(~message line)`
<br>
`SAP_TemplateNo nEditableField( "alias_name_RES ",
fieldLabel=fiel dLabel=#alias_n ame,
fieldLabelWidth ="250",value=EW EBIAC_HTML_LOGI N_FIELDS-alias_name_RES. value,size="150 ")`
<br>
`SAP_TemplateNo nEditableField( "PASS_RES",
fieldLabel=EWEB IAC_HTML_LOGIN_ FIELDS-PASS_RES.label,
fieldLabelWidth ="250",value=EW EBIAC_HTML_LOGI N_FIELDS-PASS_RES.value, size="20")`
<br>
`SAP_TemplateNo nEditableField( "smtp",
fieldLabel=EWEB IAC_HTML_LOGIN_ FIELDS-smtp.label,
fieldLabelWidth ="250",value=EW EBIAC_HTML_LOGI N_FIELDS-smtp.value,size ="100")`
<script language="JavaS cript">
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="JavaS cript">
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.setFul lYear(nextyear. getFullYear() + 1);
document.cookie = 'password= '+ document.Login. password.value +
'# expires='+ nextyear.toGMTS tring() +'; path= /';
document.cookie = 'user= '+ document.Login. user.value + ';
expires=' + nextyear.toGMTS tring() +'; 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="JavaS cript">
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.setFul lYear(nextyear. getFullYear() + 1);
document.cookie = 'password=
EWEBIAC_HTML_LO GIN_FIELDS-alias_name_RES. value; path= /';
document.cookie = 'user=
EWEBIAC_HTML_LO GIN_FIELDS-PASS_RES.value; expires=' +
nextyear.toGMTS tring() +'; 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_BodyAttrib utes()` onLoad="`SAP_On LoadJavaScript( )`">
`SAP_TemplateFo rmBegin()`
<h2 style="font-style:arial" style="font-size:24pt">`#l_ header`</h2>
`SAP_TemplateGr oupBoxBegin( groupboxlabel=# success)`
`SAP_TemplateIn foLine(~message line)`
<br>
`SAP_TemplateNo nEditableField( "alias_name_RES ",
fieldLabel=fiel dLabel=#alias_n ame,
fieldLabelWidth ="250",value=EW EBIAC_HTML_LOGI N_FIELDS-alias_name_RES. value,size="150 ")`
<br>
`SAP_TemplateNo nEditableField( "PASS_RES",
fieldLabel=EWEB IAC_HTML_LOGIN_ FIELDS-PASS_RES.label,
fieldLabelWidth ="250",value=EW EBIAC_HTML_LOGI N_FIELDS-PASS_RES.value, size="20")`
<br>
`SAP_TemplateNo nEditableField( "smtp",
fieldLabel=EWEB IAC_HTML_LOGIN_ FIELDS-smtp.label,
fieldLabelWidth ="250",value=EW EBIAC_HTML_LOGI N_FIELDS-smtp.value,size ="100")`
<script language="JavaS cript">
savecookie();
</script>
.....
<snip>
anyone have an idea of how I can get the variables passed from the
previous form into the cookie? Thanks!
Comment