Click to See Complete Forum and Search --> : Problems with form


mrdhimself
10-05-2007, 05:34 AM
Hey guys

I got an enquiry form which has links to other enquiry pages. Does anyone know how i could get all these pages in one, given that they only appear if the user wants them to. So they click a link and then a box appears on the same site with all the additional questions for that section???

fanx already

ryanbutler
10-05-2007, 04:02 PM
You would have to check the URL and then provide info based on that. If in PHP, then if you had a link like:

<a href="by?=B">B</a>

<a href="page?=2">2</a>

Then the PHP would be:

<?php

if(isset($_GET['by']){
$letter=($_GET['by']);

//show info for b here

else if(isset($_GET['page'])){
//show info for page 2 here
}
}
?>

mdjo
10-05-2007, 04:12 PM
I'm doing something like this now on my current project. It uses a ton of Javascript. Basically, create each section of the form within a <div>. Create a style with an attribute of "display: none", and attach it to each of the div's. Then when you determine that a given form should appear, change the style on the appropriate div with Javascript.

ryanbutler
10-06-2007, 11:22 AM
That would work as long as you ensure the content is still visible if JavaScript is disabled.

mdjo
10-08-2007, 08:38 AM
That would work as long as you ensure the content is still visible if JavaScript is disabled.

Well, sure. If you want to support users who've disabled their Javascript, then you either have to fall back to something that displays all portions of the form when Javascript is disabled, and I'd say append some note that says that you should only fill in the portions that apply to you; or you have to do it all on the server side. If we're allowing for the possibility that they've disabled Javascript, I presume we would also have to allow for the possibility that they've disabled applets and will refuse any COM objects, etc. With those assumptions, then no matter what tools you're using -- PHP, JSP, ASP, whatever -- I don't see how it would be possible to do this the way the original post asked: making the screen sections appear as the user entered data. You'd have to do it with two screens: one to collect the data that tells you which sections of the form they need, and then a second to that examines this data and creates the form with the appropriate sections.

The original post didn't say just what data he needs to make this decision. If it's fairly straightforward, that might well be the better design. Like, screen 1 has a small number of questions, like "What country do you live in? What is your age? Have you ever been convicted of a felony involving goats?" or whatever. Then screen 2 shows the form. But if the interaction of the data is complex, this might not be practical. If question #1 determines whether or not we need section A, but then there's a question in section A that determines whether or not we need section C, and a combination of questions from section A and section B determine if we need section D, etc. then you either have to use something on the client side, or you have to show each section as a separate web page.

Without more info on the details of the requirements, I can't say.

mdjo
10-08-2007, 08:42 AM
Oh, and perhaps I should add: If we want to do the "display all portions of the form if Javascript is disabled", then I'd say that the form must be written to show all portions, and have a Javascript function kicked off by <body onload> that turns all the optional sections off initially. Then if there is no Javascript, everything starts out visible. If there is Javascript, it all starts out invisible. For of course if you write the form with everything invisible and it takes Javascript to turn it on, and Javascript has been disabled, then there is no way to turn it on.

mrdhimself
10-12-2007, 01:04 AM
Fanx for ur responses so far. Screen 1, the original, is a simple form, asking for contact details, name, email, etc... Then, at present, the user has a choice of links to click, to get to the specific order form for a product. I wud like the user to click on something, or select from a list, and then this section appears under the other form, with a question underneath that, sayin "want more?" and another dropdown box appears, and the whole process can start again. If the user is finished, he clicks submit, and i get one email showin all the info the customer entered. If u want the code, just tell me

fanx again

mdjo
10-12-2007, 09:47 AM
Just trying to understand what you're up to: Are you thinking that the possible sections are the same, and the user can just keep adding new ones indefinately? Or are there some fixed number of defined sections, and the user can select some combination of these?

In either case, the first question is whether you're going to do it on the server side or the client side. Advantage of doing it on the server side is that the code is a lot simpler, and you can use real programming languages like PHP or Java, while the client side is pretty much stuck with Javascript. Advantage of doing it on the client side is that it doesn't require a round trip to the server every time the user adds a block and you don't have to pass the data back and forth.

ryanbutler
10-12-2007, 11:48 AM
Well, sure. If you want to support users who've disabled their Javascript, then you either have to fall back to something that displays all portions of the form when Javascript is disabled, and I'd say append some note that says that you should only fill in the portions that apply to you; or you have to do it all on the server side. If we're allowing for the possibility that they've disabled Javascript, I presume we would also have to allow for the possibility that they've disabled applets and will refuse any COM objects, etc. With those assumptions, then no matter what tools you're using -- PHP, JSP, ASP, whatever -- I don't see how it would be possible to do this the way the original post asked

Oh good grief, lighten up. I was just saying that if you're going to rely solely on JS to do this, and if a user tries to use with JS enabled, then your application doesn't work, then it doesn't satisfy the requirement of accomplishing something for the user, which is common sense.

Reads like it's more of a server-side solution. I'd have to have a better understanding of what's going on.

mdjo
10-12-2007, 12:16 PM
Hmm, not sure what you mean by the "lighten up". I wasn't trying to be sarcastic. Yes, it's possible that the user has disabled Javascript. If we want our program to work for users who have done this, then clearly we can't rely on Javascript. But by the same reasoning, some users will disable applets, refuse to download a COM object, etc. Almost anything that happens on the client side could potentially be disabled by the user.

So we have two choices: 1. Rely only on plain HTML on the client and do all actual coding on the server side; or 2. Tell the user that the page won't work if they disable the tools we are using. If this is a product for, say, in-house use at your own company, it's probably easy to tell your users what they should and shouldn't disable. If this is for people who are already your customers -- like they've already opened an account with you and now you're offering web access to view statements -- then you still could impose somewhat but not quite as freely. If you're trying to solicit customers through your web site and any annoyance may lead them to abandon your site and try the competition, then you want to be very careful.

Usually I try to do almost everything on the server side, and include fallbacks for any Javascript so it will be useable, if not necessarily pretty, with Java disabled. It all depends what you're up to and how you view the trade-offs.

If your position is that you refuse to rely on client-side tools that could be disabled, then yes, this problem is not solvable as desribed, and the approach must be redesigned to use a server-side solution, pretty much by definition. But that's a big "if".

ryanbutler
10-12-2007, 03:26 PM
If your position is that you refuse to rely on client-side tools that could be disabled, then yes, this problem is not solvable as desribed, and the approach must be redesigned to use a server-side solution, pretty much by definition. But that's a big "if".

Somehow this thread has defeated it's purpose of trying to help the OP and instead defend something that doesn't need defending. I never said I refuse to develop anything. My whole point is if if you're working with a form that shows and hides information that's required before it's allowed to submit, and this information isn't visible with JS disabled then you have a real problem on your hands. If the user can't fill it out because it's not there, then how will the application work?

Yes, the average web user wouldn't disable, but that's besides my point. Most JS menu's don't work with JS disabled. Again, the average web user doesn't disable that, but, your navigation is completely inaccessible to search engines, which is not good. My whole point is consider the audience as you mentioned. We're saying the same thing, just in different ways.

Enough about this silly circle that we're playing. To the OP, if you'll post what you're trying to do code wise, someone, will probably help, me included, if I know the answer.

mrdhimself
10-16-2007, 01:21 AM
Ok, here is the main menu with one of the sub-pages. The other ones are the same more or less in style, so if u cud help me wit one, than i props can do the rest alone

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>



<body>


<p align="center"><font size="6"><b>Enquiry Form</b></font></p>

<form action="mail2.php" method="post">

<p align="left">
Name: <input type="text" name="name" size="20"><br>
Organisation: <input type="text" name="organisation" size="20"><br>
Street: <input type="text" name="street" size="20"><br>
Number: <input type="text" name="number" size="8"><br>
Zip/Postal Code: <input type="text" name="postalcode" size="10"><br>
City: <input type="text" name="city" size="20"><br>
Country: <input type="text" name="country" size="20"><br>
Work Phone: <input type="text" name="phone" size="20"><br>
E-mail: <input type="text" name = "email" size="20"><br>
URL: <input type="text" name = "url" size="20"><br>&nbsp;</p>


<p align="left">
&nbsp;&nbsp;&nbsp; <a href="storage_tank.htm">Storage Tank</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="cold_converters.htm">Cold Converters</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="transportation_tanks.htm">Transportation Tanks</a></p>


<p align="left">
&nbsp;</p>


<p align="left">
&nbsp;&nbsp;&nbsp; <a href="vaporisers.htm">Vaporisers</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="cryoseal.htm">Liquid Nitrogen Containers/Dewars</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="special_products.htm">Special Products</a></p>


<p align="left">
<br>
<input type="submit" value="Submit">
</p>


</form>




</body>

</html>



<HEAD>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<TITLE>Storage Tank</TITLE>
</HEAD>
<BODY>


<script>
function ab()
{
var x= window.confirm("Thank you for submitting your request! We shall revert back to you very shortly! You will now return back to the Enquiry page, where you can submit further requests, or submit your entire form")
if (x)
{

history.go(-2)

}
else
window.location="http://169.254.0.1/test/storage_tank.htm"

}

</script>


<H1 align="center">Storage Tank</H1>
<HR>
<form action="mail3.php" method="post" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">

<p align="left">Please re-enter email, sorry for the inconvenience: <input type="text" name="email" size="20"></p>

<p align="left">Gross capacity: <!--webbot bot="Validation" s-display-name="Gross capacity" s-data-type="String" b-allow-digits="TRUE" b-value-required="TRUE" i-minimum-length="4" i-maximum-length="6" --><input type="text" name="capacity1" size="8" maxlength="6" /> <select size="1" name="unit11">
<option>liters</option>
<option>gallons</option>
</select> </p>
<p align="left">Service: <select size="1" name="service1">
<option>LIN</option>
<option>LOX</option>
<option>LAR</option>
<option>LCO2</option>
<option>LNG</option>
</select></p>
<p align="left">Configuration: <select size="1" name="configuration1">
<option>Horizontal</option>
<option>Vertical</option>
</select></p>
<p align="left">Pressure: <!--webbot bot="Validation" s-display-name="Pressure" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="4" --><input type="text" name="pressure1" size="6" maxlength="4" /> <select size="1" name="unit21">
<option>psi(g)</option>
<option>kg/cm²(g)</option>
</select></p>
<p align="left">Quantity:&nbsp; <!--webbot bot="Validation" s-display-name="Quantity" s-data-type="String" b-allow-digits="TRUE" --><input type="text" name="quantity1" size="8" value="1" /></p>
<p align="left">Design code/certification: <select size="1" name="designcode1">
<option>ADM</option>
<option>ASME</option>
<option>Others</option>
</select></p>
<p align="left">Pump connection: <select size="1" name="pump1">
<option>None</option>
<option>Reciprocating cylinder filling</option>
<option>Centrifugal transfer</option>
</select></p>
<p align="left">Applications: <textarea rows="3" name="application1" cols="20"></textarea></p>
<p align="left">Requirement: <select size="1" name="requirement1">
<option>Firm</option>
<option>Budgetary</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p align="left">Purchase decision: <select size="1" name="decision1">
<option>Immediate</option>
<option>2-4 weeks</option>
<option>4-6 weeks</option>
<option>6-8 weeks</option>
<option>Later</option>
</select></p>
<p align="left">Required delivery period: <!--webbot bot="Validation" s-display-name="Required delivery period" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="3" --><input type="text" name="delivery1" size="3" maxlength="3" />(weeks from PO date)</p>
<p align="left">Country of installation/use: <!--webbot bot="Validation" s-display-name="Country of Installation" b-value-required="TRUE" i-minimum-length="3" --><input type="text" name="country1" size="20" /></p>
<p align="left">Nearest airport: <!--webbot bot="Validation" s-display-name="Nearest Airport" b-value-required="TRUE" i-minimum-length="2" --><input type="text" name="airport1" size="20" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nearest seaport: <!--webbot bot="Validation" s-display-name="Nearest Seaport" b-value-required="TRUE" i-minimum-length="1" --><input type="text" name="seaport1" size="20"></p>
<p align="left">Notes: <textarea rows="5" name="notes1" cols="32"></textarea></p>
</P>
<P>
<BR>
</P>

<INPUT TYPE=submit VALUE="Submit Form" name="Submit" onclick="ab()">
<INPUT TYPE=reset VALUE="Reset Form" name="Reset">
</FORM>
<HR>
<p><b><font size="2">Made by: Vincent Dekker for Inox India</font></b></p>
</BODY>
</HTML>


fanks a million

mrdhimself
10-23-2007, 02:25 AM
I'm doing something like this now on my current project. It uses a ton of Javascript. Basically, create each section of the form within a <div>. Create a style with an attribute of "display: none", and attach it to each of the div's. Then when you determine that a given form should appear, change the style on the appropriate div with Javascript.

Could you please elaborate on how to do this, im pretty new to this! Is that also possible with php, rather than javascript? fanx