close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Validating Multipage form

Thread began 1/11/2010 11:55 am by Walikan | Last modified 1/25/2010 6:26 pm by Jimmy Wu | 2954 views | 11 replies |

Walikan

Validating Multipage form

Hey Support,
I created three forms(page1.php, page2.php and page3.php) and can (custom coded) pass form field information using session variables from one page to another and eventually to the db. I have tried the server side validation and tested the form and it does not work. Is it pdssible to use VT to validate multipage form? Can some one help?
Appreciate your help in advance

Sign in to reply to this post

Jimmy Wu

Are you applying validation to each page or attempting to validate all the information on the last page?

If you are applying server validation make sure to apply it to the page that the form action is set to, not on the same page that the form is on.

Sign in to reply to this post

Walikan

Hello Jimmy,
Thanks for your prompt feedback. I have attached the Zip of the three pages

  Are you applying validation to each page or attempting to validate all the information on the last page?
.  


I am applying validation on each page. I do not know how to apply on all information on the last page.

  If you are applying server validation make sure to apply it to the page that the form action is set to, not on the same page that the form is on.  


Is is possible to do that? I must be doing something wrong
Each time I try to apply server validations, only the page that contain the form fields pops up, for instance, if I were to apply validation on page1.php, only the form fileds of page1.php pops up on the server validation window. But the action of page1 is set to page2.php. I must have not understood exactly what you meant. From the attachment you will probably see exactly where I am wrong.
Thanks

Attached Files
MultipageFprm.zip
Sign in to reply to this post

Jimmy Wu

In Dreamweaver you will have to add the form data to the page you are applying the validation on. So on page2 you will go into the bindings panel and click on the "+" button. Then you will select form data and select page1 as the page to add the form data from. Then on page2 you will be able to validate on that form data and set the failed redirect to page1.

Sign in to reply to this post

Walikan

Validating Multipage form

Hello Jimmy,
Thanks a million. It worked perfectly. You made my day.
Just a very last question. I forgot to add a page (page.php) in the attachment on the previous post.
On the page.php, I have hand coded a php switch condition statement and I have a form below to integrate the switch statement. In the form there are 3 radio buttons representing Pages i e
radio button1 = page1.php
radio button2= page2.php
radio button3 =page3.php

When a user select say, radio button1 and complete the rest of the form fields and then clicks on the submit button, the user is redirected to page1.php
Similarly selecting radio button2 and complete the other form elements in the form and then clicks on submit button, the user is redirect to page2.php. I know I need to add a custom code on the form action, any help on how to achive this? See attachment for details


<?php
session start()
switch(#{destination}) {

case "1" :
header("Location: page1.php");
break;
case "2 ":
header("Location: page2.php");
break;
case "3 ":
header("Location: page3.php");
break;

}
exit();
?>
<form id="form1" method="post" action=" ">
<table width="403" border="0">
<tr>
<td width="104"><p>
<label>
<input type="radio" name="select" value="p1" id="select_0" />
Page 1</label>
<br />
<label>
<input type="radio" name="select" value="p2" id="select_1" />
Page 2</label>
<br />
<label>
<input type="radio" name="select" value="p3" id="select_2" />
Page3</label>
<br />
</p></td>
<td width="144">&nbsp;</td>
<td width="141"><?php
if (ValidatedField('page1_214','page1_214')) {
if ((strpos((",".ValidatedField("page1_214","page1_214").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<font color="#FF0000">Select one</font>
<?php //WAFV_Conditional page1.php page1_214(1:)
}
}
}?></td>
</tr>
<tr>
<td>Arrival Date</td>
<td><label>
<input name="ArrivalDate" type="text" id="ArrivalDate" size="10" />
</label></td>
<td><?php
if (ValidatedField('page1_214','page1_214')) {
if ((strpos((",".ValidatedField("page1_214","page1_214").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
<font color="#FF0000">Pick Date</font>
<?php //WAFV_Conditional page1.php page1_214(2:)
}
}
}?></td>
</tr>
<tr>
<td>Arrival Time</td>
<td><label>
<input type="text" name="ArrivalTime" id="ArrivalTime" />
</label></td>
<td><?php
if (ValidatedField('page1_214','page1_214')) {
if ((strpos((",".ValidatedField("page1_214","page1_214").","), "," . "3" . ",") !== false || "3" == "")) {
if (!(false)) {
?>
<font color="#FF0000">Time is required</font>
<?php //WAFV_Conditional page1.php page1_214(3:)
}
}
}?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label>
<input type="submit" name="submit" id="submit" value=">>> Continue" />
</label></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</form>

Thanks alot for the help

Attached Files
MultipageFprm.zip
Sign in to reply to this post

Jimmy Wu

If you are handling the forwarding at the top of the page, you can leave the form action blank, so the form will post to the current page.

What you can do is to post the form to a page and have that page check the value of the radio button and then forward based on that.

Sign in to reply to this post

Walikan

Hello Jimmy,
Thanks for your help. You said

  If you are handling the forwarding at the top of the page, you can leave the form action blank, so the form will post to the current page.

What you can do is to post the form to a page and have that page check the value of the radio button and then forward based on that.  



I left the form action blank. Jimmy, I will appreciate if you can illustrate with a sample code. I am new to php and still trying to learn the language. The zip file in the previous post has all the files. Kindly use the files to illustrate what you meant.
Thanks alot for all your help

Sign in to reply to this post

Jimmy Wu

I made a sample page that forwards to different pages depending on which radio button is selected. First the radio buttons' values have to have the page that you are forwarding to stored in them. Then you can check if the radio group is set after the form is submitted. Then you can just set the location to be the radio button value and it will forward. Here is the code for the page:
<?php
if(isset($_POST["RadioGroup1"])) {
header("Location: ".$_POST["RadioGroup1"]);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>



<body>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="radio" name="RadioGroup1" value="untitled1.php" id="RadioGroup1_0" />
Page1</label>
<br />
<label>
<input type="radio" name="RadioGroup1" value="untitled2.php" id="RadioGroup1_1" />
Page2</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
<br />
</p>
</form>
</body>
</html>

Sign in to reply to this post

Walikan

Hello Jimmy,
Thanks a million. It worked as was expected. If one keeps buying Web Assist extensions, it is because of your relentless support. Your support team is doing a great job.
Thanks alot.

Sign in to reply to this post

Jimmy Wu

Great to hear you were able to get it working. If you run into any additional issues, feel free to open a new thread.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...