| |

VerySource

 Forgot password?
 Register
Search
View: 2856|Reply: 19

Submit 2 forms with one button

[Copy link]

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-5 19:10:01
| Show all posts |Read mode
I filled out a form first (before submitting it) and now I want to submit some (not all) of them to another form, so I made another form (this one is hidden, 2 on one page) !! I wonder if it can be achieved through a submit button
2 forms submission
   There are other ways to achieve it ~~ Everyone help me ~! !! !!
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-6 20:42:01
| Show all posts
In the event of the button, use a script to write, form1.submit (); form2.submit (); I remember it seems OK. You try
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-7 09:24:01
| Show all posts
You mean there are two forms, right?
But you can use javascript to trigger with onMouseOver and you can add data as soon as you can .. Others you should think
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-7 12:36:01
| Show all posts
I filled out a form first (before submitting to 1.jsp) and now I want to submit some (not all) of them to another form 2.jsp, so I made another form (This one is hidden, 2 are on one page) !! I wonder if it can be achieved through a submit button
2 forms submission
   There are other ways to achieve it ~~ Everyone help out ++++
   Participation is worth it
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-7 21:54:02
| Show all posts
Ask another question !!
How the hidden form gets values ​​from the previous form
document.form.ID.value = document.registerForm.ID.text Why doesn't this work? !!
Reply

Use magic Report

0

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-8 14:18:01
| Show all posts
form.ID.value = registerForm.ID.value;
This should be okay
There is also the problem of submitting two forms. It is not recommended that you do this, because one form has one action, then the two forms need to be ACTION to two pages, which is not easy to handle. It is better to use one form to send to The page you send to handle the two forms you need
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-9 15:45:01
| Show all posts
In general, it is not advisable to submit two forms with one button, but there are several ways to choose:
1, can be implemented with iframes, placed in two iframes
2. With the hidden form, when you click submit, all the fields of one form are first transferred to the corresponding hidden form, and the hidden form is placed in another form, which is equivalent to submitting only one (there is no hidden form) That) form.
3. Set all fields in the two tables to the session, and then get them from the session when getting the fields.
There are no cookies or anything.
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-21 20:27:01
| Show all posts
悲雪狂沙I also thought about the method you said ~~ But after I submitted the data (that is, written into the database), I then read out some of them (using a hidden form) and wrote it into another form. Reading out some of the data, there were some problems in the database operation twice. ~~ The following is part of the code !!!!! Please help me to see ~~ See how to achieve ~~~ I am a novice ~~~~~ ~
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-21 20:45:01
| Show all posts
<% Connection conn = null;
 Statement stmt = null;
  ResultSet rs = null;
 try {
 Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
 conn = DriverManager.getConnection ("jdbc: odbc: xiaohai", "sa", "");
 stmt = conn.createStatement ();
 String strSQL = "insert into ProConsult";
 strSQL + = "values ​​(";
strSQL + = "'" + projectname + "',";
    strSQL + = "'" + sort + "',";
strSQL + = "'" + contactmen + "',";
strSQL + = "'" + contactphone + "',";
strSQL + = "'" + examarrange + "',";
strSQL + = "'" + examrequire + "',";
strSQL + = "'" + examtime + "',";
strSQL + = "'" + profinish + "',";
strSQL + = "'" + responsemen + "',";
strSQL + = "'" + exammen + "')";
    stmt.executeUpdate (strSQL);
stmt.close ();
out.println ("<font> Project information is as follows: </ font>");
out.println ("<center> <font size = '3'>" + "Project registration was successful and successfully sent to" + exammen + "</ font> </ center>");
out.println ("<table width = '70% 'border =' 1 'cellspacing =' 1 'align =' center 'bgcolor =' # FFFFFF 'bordercolorlight =' # 006633 '> <tr bgcolor =' # ffffff '> <td width = '30% 'height = '25' align = 'right'> Project name: </ td> <td height = '25 'width = '70%'> ");
out.println (projectname); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Category: </ td> <td>");
out.println (sort); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Contact: </ td> <td>");
out.println (contactmen); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Contact number: </ td> <td>");
out.println (contactphone); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Survey arrangement: </ td>");
out.println ("<td> <input type = 'hidden' value = '" + examarrange + "'>"); out.println (examarrange); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Survey requirements: </ td>");
out.println ("<td> <input type = 'hidden' value = '" + examrequire + "'>"); out.println (examrequire); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Survey completion date: </ td> <td>");
out.println (examtime); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Project completion date: </ td> <td>");
out.println (profinish); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Negotiator: </ td> <td>");
out.println (responsemen); out.println ("</ td> </ tr>");
out.println ("<tr bgcolor = '# ffffff'> <td align = 'right' height = '25 '> Investigator: </ td> <td>");
out.println (exammen); out.println ("</ td> </ tr>");
} catch (Exception e) {out.println ("<center> <font size = '3'>" + "Project registration failed. </ font> </ center>");}
     


finally {
try {
if (stmt! = null) {stmt.close ();}
if (conn! = null) {conn.close ();}
} catch (SQLException e) {}
   
  }

%>
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-23 22:45:02
| Show all posts
I think it is still to synthesize a form submission, get the submitted form data in the controller (servlet), and then encapsulate the form data according to the conditions. Redistribute it to different pages. Or save the content to a certain scope (session\request, etc.) .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list