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

How to submit a javascript value

 
deepannita singh
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all, Please help me out!!
I am new to the javascript,
I want to submit javascript var value with html forms. Like..

<script type="text/javascript">
function form_submit(){
var count = 100;
document.myform= count; <-- Here I want to submit the "count" value. And I want to get it in the subroutine.
document.myform.submit();

}

</script>
<form name="myform" action="[% c.uri_for('/home/updateval') %]" method="post" > <-- here "updateval" is the subroutine name in the controller.

Thanks in advance...
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33720
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepannita,
Welcome to CodeRanch!

You've probably noticed that document.myform= count; doesn't work. That's trying to assign a value to a form.

One approach is to create a hidden field:
<input type="hidden" name="number" />

Then you can use JavaScript to set it:
document.myform.number.value = count;

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic