Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Repopulating form problem

 
Mariusz Bogucki
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the HTML/Javascript forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic