You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sunil Sahu <Su...@KeaneIndia.Com> on 2004/07/17 07:18:56 UTC
RE: How to append select option to html:link
Hi cdroderick,
I think this is piece of code which will fulfill ur requirement..
<script language='javascript'>
function testLink(actionName)
{
Var selectValue
=document.fm.chartFormat.options[document.fm.chartFormat.selectedIndex].valu
e;
document.fm.action=actionName+"?vectorInfo="+selectValue;
document.fm.submit();
}
</script>
<html:form name=fm>
<html:link href="#" onclick="testLink('SingleVectorChartAction.do')"
name="attributes">chart</html:link>
<html:select name="VectorInfoForm" property="chartFormat" size="1">
<html:option value="1">DHTML (IE Only)</html:option>
<html:option value="2">Java</html:option>
</html:select>
</html:form>
sahu
-----Original Message-----
From: cdroderick [mailto:Chris.Roderick@cern.ch]
Sent: Friday, June 25, 2004 3:16 PM
To: struts-user@jakarta.apache.org
Subject: How to append select option to html:link
Hello,
I have a JSP with a list of dynamically generated html:links. Each
link has a map of attributes appended e.g.:
<html:link href="SingleVectorChartAction.do?" name="attributes">chart
</html:link>
On the same page, I have a html:select e.g.:
<html:select name="VectorInfoForm" property="chartFormat" size="1">
<html:option value="1">DHTML (IE Only)</html:option>
<html:option value="2">Java</html:option>
</html:select>
I would like that when a link is clicked, not only the map of
attributes is appended, but also the current value of the select
option. I know how to get the current option value with javascript
e.g.:
document.forms[0].chartFormat.options[document.forms
[0].chartFormat.selectedIndex].value
but I don't know how to append this to link.
Does anybody know how to do this without re-submitting the form?
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org