1

Problem: I have 2 frames, each with a form. One frame is for navigation, the other is for 'doing stuff'

I want to click something in Frame A (Navigation frame) and get the following behavior:
1) Submit the form in Frame B (to save changes)
2) Change the location of Frame B after saving changes (Navigate)
3) Frame A should not submit/reload

So far, I can accomplish either of the above goals (1 or 2), but I can't save changes AND navigate in the same act. I can get one or the other to work but I don't understand why.

Frame A (Navigation) uses code like this:

<a href="" onclick="return rowClicked(stuff)"> Navigate to Something </a>

Javascript for rowClicked:

top.frameB.document.getElementByID("frame_b_form_id").submit();
top.frameB.location="new location, so we can navigate";
return false; // Keeps frame A (Navigation) from reloading

My problem: If I don't change the location, my form in frame b submits and everything works perfectly. But I want to navigate! If I add the top.frameB.location javascript, the navigation works, but the form in the other frame doesn't get submitted!

I'm sure there's something simple I'm missing!

EDIT: This problem is in the latest Chrome and firefox browser versions ... This code seems to work as desired in IE 11, IE 8, FF 3.03

Last EDIT: I never figured out how to do this consistently across browsers. Fortunately, I realized that there was a better way to accomplish what I wanted. The page was generated by mod_perl code, so 'submitting' the page caused not only the data saving, but also page re-generation (of the page the user was already on). Navigating after that meant the server wasted time generating the page the user was navigating away from, on form submission. The real fix was in my perl code so that a form submission triggered navigation ... I used javascript to add hidden inputs that were included with the form - the hidden inputs tell the server that after saving, generate a different page (ie navigate) and return that, instead of re-generating the page the user just visited & saved.

  • Do this help you? http://stackoverflow.com/a/12499708/278405 – cychoi Apr 17 '14 at 23:12
  • That seems like it might have helped, but I did not use that. I realized that my approach was all wrong - submitting, then navigating, doubled the work load for the server. I added hidden inputs to the page before submitting, these told the server that after saving data, the new web page should be for a different 'location' (ie, after saving, navigate). The html in question is dynamically generated via perl + mod_perl, so every submit equaled page generation. Submit then change location = 2 page generations, only the second of which will get used (since the goal is navigation). – user3546706 Apr 20 '14 at 03:43

0 Answers0