File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html select onchange problem

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




syntax error:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic