Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html select onchange problem

 
Ingoba Ningthoujam
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ingoba Ningthoujam:



where you write your function "func"?
 
Ingoba Ningthoujam
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ingoba Ningthoujam:




syntax error:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic