• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dropdown/onchange

 
thomas colding
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like that selecting a new value in a Dropdown should result a windows refresh.
Do I have to create a javascript function that is called when the dropdown selection is changed.
And the the javascript submit the jsp.
I am a little confused since according to many topics in this Forum we should avoid using javascript in the pages since a User can disable the javascript.

What is the correct way to do the mentioned above, any sample is appreciated.
 
Rituraj Jain
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No doubt, if you want to submit page on the selection in javascript you should be using Java Script.

if every body will think that the user will disable JavaScript then this is also equally true that if he disables javascript he will not be able to open most the websites.
so its perfectly fine if you use javascript in your code...
 
thomas colding
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rituraj Jain wrote:No doubt, if you want to submit page on the selection in javascript you should be using Java Script.

if every body will think that the user will disable JavaScript then this is also equally true that if he disables javascript he will not be able to open most the websites.
so its perfectly fine if you use javascript in your code...


I have tried following javasrcript code

function selectChanged(obj){
alert(obj);
document.inputform.submit();

}


but nothing happeend, what I am missing since the JSP is not submitted.
 
Rituraj Jain
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry friend here code can not be provided....however i can give you a suggestion

why don't you search google with this phrase submit form using javascript
 
thomas colding
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rituraj Jain wrote:sorry friend here code can not be provided....however i can give you a suggestion

why don't you search google with this phrase submit form using javascript

By the way thanks for you input :0)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64716
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on JSP. For more information, please read this.

This post has been moved to a more appropriate forum.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened? Did you get a JavaScript errror when you tried to submit? Did you get the alert?

Eric
 
thomas colding
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I make a Submit with my javascribt I can not catch the value in the processaction in my portlet.

My Javascribt line is as following
document.inputform.submit();

And my JSP has the formname <form name="inputform" METHOD="post" ACTION="">

Maybee it is a simple Question, but it is a big challenge when you do not have any experiance in Portlet-development.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
document.formName.submit() is basically the same thing as clicking a submit button, you just do not get the submit button name sent to the server. If you want an action set, than set an action.



Eric
 
thomas colding
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks It does work now
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic