This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes html select onchange problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html select onchange problem" Watch "html select onchange problem" New topic
Author

html select onchange problem

Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
how to call a javascript function using html select onchange in struts?
eg;
<html:html>
<head>
<script>
function fun1()
{
var id=document.getElementById("category").value
if (id != 0)
{
alert("Please Select a Subcategory");
document.form.id.focus();
return false
}

}</script>
</head>
<body>
<html:from action="/set.do" >
<html:select property="name" onchange="javascript:func()"/>
</html:form>
</body>
</html:html>
I am using Struts 1.2.9 so I cant put the name attribute in form.Pliz help me.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by Ingoba Ningthoujam:



where you write your function "func"?


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
I am using Struts 1.2.9 so I cant put the name attribute in form.I want to call an action through javascript function.Pliz help me.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by Ingoba Ningthoujam:




syntax error:
 
 
subject: html select onchange problem
 
Similar Threads
Struts Tag Library
javascript function
html select onchange
how to access combo-box value in javascript?
form submission