aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Dropdown/onchange Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dropdown/onchange" Watch "Dropdown/onchange" New topic
Author

Dropdown/onchange

thomas colding
Ranch Hand

Joined: Mar 23, 2007
Posts: 60
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

Joined: Nov 28, 2008
Posts: 37
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...


Rituraj Jain
thomas colding
Ranch Hand

Joined: Mar 23, 2007
Posts: 60
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

Joined: Nov 28, 2008
Posts: 37
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

Joined: Mar 23, 2007
Posts: 60
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

Joined: Jan 10, 2002
Posts: 61433
    
  67

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
What happened? Did you get a JavaScript errror when you tried to submit? Did you get the alert?

Eric
thomas colding
Ranch Hand

Joined: Mar 23, 2007
Posts: 60
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Mar 23, 2007
Posts: 60
Thanks It does work now
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dropdown/onchange