[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSL-List Digest V3 #1291

Subject: RE: XSL-List Digest V3 #1291
From: "Pekarek, Rose (MN10)" <rose.pekarek@xxxxxxxxxxxxx>
Date: Wed, 28 Nov 2001 12:40:44 -0600
html autosubmit form onload
David,

As it turns out, it is not possible to load a value to a hidden field.  I
had to change the input type to text.  The reason I wanted a hidden field is
because I wanted to autosubmit a form with the user's user and password set
from the cookie.  I ended up using the setTimeout event in my onload code to
submit the form like this:


function get() {
    document.Login.us.value = rot13(Get_Cookie("us"));
    document.Login.pw.value = rot13(Get_Cookie("pw"));
    setTimeout("autosubmit()",500);
}  
----------------------------------------------
Subject: Re:  Need to set hidden field using javascript function

I think what you are trying to do is get a client cookie value into that
INPUT
tag.
Remember, client cookie data isn't available inside the transform.  Best
bet,
put the INPUT
tag in the body, and then use a body.onload() event to load the value, on
the
client side,
using the browser.

IE example:

<HTML>
	<HEAD>
		<TITLE>demo</TITLE>
		<SCRIPT>
			// Retrieve the value of the cookie with the
specified name.
			function GetCookie(sName)
			{
			  // cookies are separated by semicolons
			  var aCookie = document.cookie.split("; ");
			  for (var i=0; i < aCookie.length; i++)
			  {
			    // a name/value pair (a crumb) is separated by
an equal sign
			    var aCrumb = aCookie[i].split("=");
			    if (sName == aCrumb[0])
			      return unescape(aCrumb[1]);
			  }

			  // a cookie with the requested name does not exist
			  return null;
			}
		</SCRIPT>
		<SCRIPT language="javascript" for="oBody" event="onload()">
			form1.hiddenelement.value = GetCookie("us")
		</SCRIPT>
	</HEAD>
	<BODY id="oBody">
		<FORM name="form1">
			<INPUT type="hidden" name="hiddenelement"/> <!--
note proper XHTML -->
		</FORM>
	</BODY>
</HTML>

On Tue, Nov 27, 2001 at 07:54:08PM -0800, Robert Koberg wrote:
> what you are trying to do is:
>
> <html>
> <body>
> <form>
> <input type="hidden" value="rot13(Get_Cookie("us")">
> </form>
> </body>
> </html>
>
> There are a few problems with this and it has nothing to do with XSLT.
> First get it to work in html and then create your xslt.
>
> best,
> -Rob
>
>
>
> ----- Original Message -----
> From: "Pekarek, Rose (MN10)" <rose.pekarek@xxxxxxxxxxxxx>
> To: <xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx>;
> <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, November 27, 2001 5:48 PM
> Subject:  Need to set hidden field using javascript function
>
>
> > I am trying to set the value of a hidden field using the return value of
a
> > javascript function.
> >
> > For example:
> >
> > <input type="hidden" name="us">
> >         <xsl:attribute
name="value">rot13(Get_Cookie("us")</xsl:attribute>
> > </input>
> >
> > Why doesn't this work?  Would it work to set a plain variable with
> > javascript instead?  Any suggestions would be much appreciated.
> >
> > Thanks,
> >
> > Rose
> >

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.