• 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

setting hidden field value using javascipt

 
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are steps I need to take in order to maintain a connection between a parent window and its child window:

1. User comes in to parent window where the hidden field value is set to "" and makes some changes to the form.
2. User clicks on a button to bring up a popup window but I need to save the changes he made to the parent window first.
3. I use javascript to update the parent window and then the parent window is reloaded with the user's changes.

HERE IS MY PROBLEM:
4. I then have to change the hidden field value on the reloaded form.
5. Check the value of the hidden field value.
6. Run the function that then opens a popup window from that reloaded form and therefore keeping all the values I need to pass on to the popup window.

How do I accomplish step #4? I have been trying to get around this issue in varrious ways but to no avail. Any help or direction would be greatly appreciated.

Thanks.

[ June 12, 2007: Message edited by: Melinda Savoy ]
[ June 13, 2007: Message edited by: 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
Are you using a server-side tmplating system such as JSP? That's the best place to pre-populate the values.
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear -- thanks for the reply.

If I understand your question correctly, I am using JSP, however, I was pre-populating the hidden field value because I wanted to check that that value was indeed populating and then run my function to load the child window (popup window) but I was checking the value when initially coming into the form and consequently my function would execute when i did not want it to until the user clicked a button on the parent form to save the changes made by the user.

This is why I do not need the value populated until AFTER the page reloaded.

I hope that is making sense.
[ June 12, 2007: Message edited by: Melinda Savoy ]
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me try to get around my issue another way, is there a way to know when a page has been reloaded so that I can then execute a window.open to popup another window and still keep the values in the parent page in tact so that the child window does not loose its connection to the parent page?

I'm open. I've been trying to use a hidden field value but that get reset each time the page is reloaded. I was trying to set the hidden field value the next time I came to the parent page but that was reset, again, each time the parent page was reloaded.

Again, what I'm basically trying to do is save the changes made to the parent page before doing a window.open function to launch a popup window that I need to be able to communicate back the parent page with.

Surely there must be a way that I'm just not knowledgeable about and would appreciate ANY alternate ideas.

Thanks!!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A better solution is to et away from pop up windows and look into either using an iframe which can be placed on top of the page or look into using the XMLHttpRequest object (Ajax).

Eric
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric,

Thanks for the reply. With the help of a colleague, because we're using the Stripes framework, I was able to change the value of the hidden value via javascript and because Stripes maintains state we were able to capture the value and then run the next javascript function that launched the popup window.

Thanks for all the replies and direction given. You guys are the best.

Regards.
reply
    Bookmark Topic Watch Topic
  • New Topic