I have a set of radio buttons. When one of the options is selected, I want it to redirect to a Struts action.
<form name=termDDL>
<s:iterator value="filterOptions" var="a">
<%String [] parts = request.getAttribute("a").toString().split(":"); %>
<input type="radio" name="selectedOption" value="a" onclick="onOptionSelect()"><%=parts[0]%> <h6 style="color:gray;display: inline;"> <%=parts[1]%></h6><br>
</s:iterator>
</form>
And the javascript function onOptionSelected() is defined as follows just before the closing of the body tag.
<script type="text/javascript">
function onOptionSelect() {
//document.getElementById("courseDisplayChoice").selectedIndex = 0;
document.termDDL.action = 'displayProductsInRange.action';
document.termDDL.submit();
}
</script>
But this is not redirecting to the struts action. And I do not want to use a submit button for the same. How do I accomplish this without clicking a submit button?
You can use window.location
for redirecting from client side to anywhere.
function onOptionSelect() {
//document.getElementById("courseDisplayChoice").selectedIndex = 0;
window.location = '/displayProductsInRange.action';
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments