Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

"Double linking"

I have a log-in pagefor members to log into the memberarea site. When the "LogIn" buton is clicked, a navigation servlet displays the memeberarea in a spesific iframe (after a login servlet has verified user and pass).

However, when a user click on LogIn and is verfied, I would like a new menu to load in a iframe where the menu is. So, with one click, I would like the member area to be displayed in the main iframe, while a new menu is displayed in the menu iframe.

The action of the form is the inparameter in the navigation servlet, and to have two actions, would reqire two forms as I can see. But then there would not be only one button, even if hidden wouls there(?). I really can't see any solutions, hope some of you can.

regards
-werner
0
Cmdr_Raptor
Asked:
Cmdr_Raptor
1 Solution
 
kennethxuCommented:
there are two solutions to your problem, both involves javascript.

1. as you said, you can submit two form:
<form name=form1 target="iframe1"><input type="button" onclick="submitboth()" .... ></form>
<form name="form2 target="iframe2">.... </form>

<script>
function submitboth() {
  // transfer data from1 to form2, e.g. form2.field.value = form1.field.value
  form1.submit();
  form2.submit();
}
</script>

2. you submit one first to, say iframe1. in the page that display on iframe1, include a hidden form and use javascript to submit when page is load.

<form name="form2 target="iframe2">.... </form>

<script>
  form2.submit();
</script>
0
 
rrzCommented:
Kenneth gave two workable solutions but I thought of a third way.  When the Login button is clicked, the form that contains it targets the response to the top-level window. Then you can use JSP to decide (based on user session data) which pages to display in the frames.
<form target="_parent"  or use   <form target="_top"
0
 
Cmdr_RaptorAuthor Commented:
I've tried the second option you wrote kenneth, and it looks something like this now:

<head>
...
<script>
form_reload.submit();
</script>
...
</head>

<body>
...
<form action="menyLogg.jsp" name="form_reload" target="menu">
<input type='hidden' />
</form>
...
</body>

Not sure if I misunderstood you and did something wrong or what the problem is, but it don't work...

regards
-werner
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kennethxuCommented:
form must appears before script refer to it:

<head>
...
</head>

<body>
...
<form action="menyLogg.jsp" name="form_reload" target="menu">
<input type='hidden' />
</form>
...
<script>
form_reload.submit();
</script>
...
</body>
0
 
kennethxuCommented:
or:
<html>
<head>
...
</head>

<body onload="form_reload.submit()">
...
<form action="menyLogg.jsp" name="form_reload" target="menu">
<input type='hidden' />
</form>
...
</body>
0
 
Cmdr_RaptorAuthor Commented:
Got it working! Tnx :)
0
 
girionisCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to kennethxu

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now