velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Weatherly <...@sendmail.com>
Subject Re: <input type="hidden" value=getYear()>
Date Tue, 14 Oct 2003 16:58:35 GMT
This is more of a JavaScript/HTML question than a Velocity question.

APPROACH 1:
<html>
...
<head>
...
<script type="text/javascript" language="javascript">
<!--
function onLoadAction() {
    var formObj = document.forms["001"];
    formObj.elements["START_YEAR"].value = 2003;
}
// -->
</script>
...
</head>
<body onLoad="onLoadAction();">
...
<form name="001" method="post" action="$link.setPage("002.vm")">
<!-- START_YEAR value is replaced onLoad -->
<input type="hidden" name="START_YEAR" value="">
<input type="submit">
</form>
...
</body>
...
</html>


APPROACH 2: (Do you need to use JavaScript?)
<html>
...
<form name="001" method="post" action="$link.setPage("002.vm")">
<input type="hidden" name="START_YEAR" value="2003">
<input type="submit">
</form>
...
</html>


-Ted

Leina Last wrote:

> Hi 
> 
> Will appreciate if someone can help.
> I can't manage to get the value "2003" in <input type="hidden" value=getYear()>
from javascript if I have something like:
> 
> function getYear() {
> return 2003;
> }
> 
> <form name="001" method="post" action="$link.setPage("002.vm")">
> <input type="hidden" name="START_YEAR" value=getYear()>
> <input type="submit">
> <form>
> 
> Java:
>  String year = data.getParameters().getString("START_YEAR");
> 
> On my java server side the output of String "year" displays "getYear()" instead of "2003".
How can I get the value "2003" in the "value=getYear()" part, making use of above example.
Maybe a other way?
> 
> I also tried something "value=window.getYear()". Will I need to make use of a <div>
or <id> tag ? 
> 
> Thanks
> L
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message