• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dropdown/onchange

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks It does work now
reply
    Bookmark Topic Watch Topic
  • New Topic