Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes Sending value of input-form to two pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Sending value of input-form to two pages" Watch "Sending value of input-form to two pages" New topic
Author

Sending value of input-form to two pages

Atman Janakar
Greenhorn

Joined: Nov 30, 2008
Posts: 3
I want to send information to two different pages and make a reload of both.
One window shows the data in a graphic and the other one is the input window (table).

I have created a form:
<form action='first.php' method='post' name='form1' id='form1'>
<input type='text' name='date' value='12.3.88'>
</form>
and a second one:
<form action_='second.php' method_='post' name='form2' id='form2'>
<input type='text' name='date' value='12.3.88'>
</form>
<input name='sub_mit' type='button' onclick_='form1.submit();form2.submit();' value='Submit'>

The problem now is, that I have to change the value "date" in both forms,
but I just want one form.
As anybody got an idea?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60817
    
  65

I'm not sure what you are asking.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Atman Janakar
Greenhorn

Joined: Nov 30, 2008
Posts: 3
I want so send same information to two different windows.
When they have send the information I want to make a reload of both windows.

In detail: I have a window which displays the graphic of my anchestors-tree.
Now I want to create a new person. I open another input window, give in the new data, press the submitbutton and send the information to the database. Now I want to see the modified data in the inputwindow and in the window which contains the anchestor-tree.
[ December 02, 2008: Message edited by: Atman Janakar ]
Iain Emsley
Ranch Hand

Joined: Oct 11, 2007
Posts: 60
I'm not entirely sure if I've understood this but you could write a submitdata() function in the js which contains the logic to send the data to both pages from the original form so that when you call onclick, you call something like onklick=submitdata() and then that function works out what to send to both pages. I used something like this as a test to send data to a Perl script and servlet a while ago though didn't need it for production in the end.

(Yes I know onklick is misspelt but the form won't allow me to submit it correctly - presumably as a safety feature)
Atman Janakar
Greenhorn

Joined: Nov 30, 2008
Posts: 3
Yes that is an idea.
Tank you!

<script type="text/javascript">

function Add () {
window.document.form2.Display.value = window.document.form1.Display.value;

window.document.form1.submit();
window.document.form2.submit();
}
</script>

</head>
<body bgcolor="white">
<form name="form1" action="post" onsubmit=" Add();return false;">
<input type="text" name="Display" value='Text'>
<input type="button" value="Values of the 2ten Formular" onclick_="ADD()">
</form>

<form action='start.php' method='post' name='form2' id='form2' target='win1'>
<input type="text" name="Display" >
</form>

[ December 02, 2008: Message edited by: Atman Janakar ]

[ December 02, 2008: Message edited by: Atman Janakar ]

[ December 02, 2008: Message edited by: Atman Janakar ]
[ December 02, 2008: Message edited by: Atman Janakar ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending value of input-form to two pages
 
Similar Threads
Multiple forms and duplicate javax.faces.ViewState ids
Multiple form with one action
Retrieving Session variables into another JSP
session tracking using servlets and sessions
Multiple Submit button in one jsp