• 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

Repopulating form problem

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a little problem. I have a simple form that takes me to some sth.do, it looks sth. like this:
textfield name
textfield name
dropdown list of items
go button

I use struts
now after I push the go button, form is populated, I am redirected to the action servlet, values are evaluted, if any errors I return to this page, no problems everything is fine.
Ammong the items I also have new item if new item is selected as an opction I am taken on my way through the new Item webpage and again I come back to the primary site, no problem with repopulating the form since I keep the bean with its values.
But the problem arises when I try to use dropdown list to navigate. WHen I change the focus on my dropdown list I want the page to be reloaded according to the value that is selected on the dropdown list. I use javascript for that. So I basicly redirect to some action servlet that is always used before redirectting to this page. Now my problem is that when i use redirect from the javascript no action form is created or at least I dont know how to do that and I lose the content of name fields. I could pass them as a parameters but it sounds kind of messy. so how can I navigate from the javascript function responding to onchange atribute so my actionForm were populated with the valuse taht are already typed.


this is my javascript,I would like to know if there is any way to use action of the form that the list belongs to, from the javascript after changing focus on the dropdown list


<script type="text/javascript">
<!--
function schoolChange(form){
selInd = document.majorForm.school.selectedIndex;
ID = document.majorForm.school.options[selInd].value;

top.location.href ="major.do?id="+ID;
}

//-->
</script>



I hope you understood ...

Thank you

[ April 29, 2005: Message edited by: Mariusz Bogucki ]
[ April 29, 2005: Message edited by: Mariusz Bogucki ]
 
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
Moved to the HTML/Javascript forum.
 
Bear Bibeault
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
Rather than submitting the request via



submit the form under Javascript control with

 
Mariusz Bogucki
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You very much.
heh, very simple, I has been long time since I used JS, I guess its time to review...
 
reply
    Bookmark Topic Watch Topic
  • New Topic