Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating web forms

Status
Not open for further replies.

jino

Programmer
Apr 1, 2004
41
CA
Hi,

I want to create a web form that will be hosted in the local intranet. The user will navigate through 3 pages of the web form and click 'submit'. The form should do some calculations based on the data entered by the user and give feedback.

What are the technologies that I will have to look at for development? Which one would be ideal and what would be the factors for the decision? Do I have to look at the server side variables - I am asking this because I am not storing any data. Can the calculations be done in the form itself by storing the data entered by the user in the session?

I want to run this form as a pilot in the intranet for some time and if there is enough interest, then roll it out to the internet. What are the factors that would change when rolling out? What considerations should be made when developing the web form to facilitate internet access?

Any help would be greatly appreciated. Thanks.

jino
 
You can do the whole thing using just HTML and javascript. This requires no server-side coding at all (so you can use html, asp, jsp, php, cfm... the list goes on)- if you wish to assume that the user has javascript enabled.

If you use the method="get" in your form, then you can collect the relevant form fields (that you submitted in the first page) on the second page (maybe setting the values into hidden field elements... so that when you submit the second form it can pass along the data from the first form (and so on).

At the final page you would have all the relevant data from all the previous pages for the form. Again, using javascript, you can query/manipulate this data and write content to the page.

There would be no specific requirement for extra work when moving from an intranet environment to internet... but remember... if the user has javascript disabled, then it won't work.

So to cater for the non-javascript users, you could submit the form (using GET or POST it doesn't matter for this method) and collect the relevant data server-side (using, say, php).

As you deliver the second page, you can prepopulate the values of hidden fields with the data from the previous page. This is very similar to the previous method, except you are collecting the data and populating the form elements from the server (as the page is delivered to the client).

The final page could submit to the server and you could calculate all the data server-side... before returning the relevant information to the browser.

You wouldn't have to do anything extra to migrate it from intranet to internet.

This second method is the preferred one - since it supports pretty much everyone and their browsers. You could combine them together for a more rich experience... but it would be like swatting a fly with a frying pan - overkill.

Hope that gets you thinking.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Hi Jeff,

Thanks for the info. How can I avoid interacting with the server when I implement this form in the net? I was told I could store the variables in session - what do you think of that? I also want to give a summary of the information entered by the users in the last page.

What are the advantages or disadvantages of using any technology(asp, php, jsp) other than resourcing issues?

Thanks again

jino
 
How can I avoid interacting with the server when I implement this form in the net?
You can't if you want to implement my second (preferred) method. The first method can be modified to create one huge form and to create "pages" within the form that can be shown/hidden using javascript... giving the appearance of moving through multiple pages of the form... but not actually having to interact/reload from the server.
I was told I could store the variables in session - what do you think of that?
That would require method 2 (preferred). I wouldn't bother... there is no need. You can do the whole task without the need for session variables.
I also want to give a summary of the information entered by the users in the last page.
Both my methods endeavour to this goal.
What are the advantages or disadvantages of using any technology(asp, php, jsp) other than resourcing issues?
I can't see any from this side (that would be relevant to your scenario).

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Hi Jeff,

Thanks. I understand your second method now. Does ASP or PHP have any drawbacks like the JavaScript (Enabling and disabling). Both ASP and PHP can be coded like HTML in a document editing environment - freeware???

Can I also do verifications of fields on the pages of the form? If you answer 'Married' for your 'marital status' question in the first page I need to add an extra field in the second page to enter your 'Spouse's income' and it should be verified for greater than zero amount. I will need the reset function also (clear the fields in the page). Are these also possible with this solution?

I also need to provide definitions for technical terms to help the user fill out the form. When they click a button next to a question, it needs to load another form in a new window which explains the question. Can HTML/script combo do this also for me?

If I need to interact with the server, what about the security of the data? How can I ensure that?

What will happen to the data collected on the server side? Does it have to be deleted after the fact? I cannot store the data for privacy issues.

Any thoughts on these issues? Thanks in advance.

Jino
 
No drawbacks for using asp/php in the same way that there are for javascript. These run server-side so you know the environment in advance.

I use Textpad ( to write my server-side as well as client-side code. It's just a text editor. It is shareware and works perfectly for I want. There are plenty around and recently there was a post in this forum asking people for suggestions on what they should use. You will have no problem using such a tool for this.

The verifications would be done server-side... so if you chose married, you would get an extra field output from the server-side code... so the html would have the extra field based on previous screen's data.

Your help screens would be best done as javascript windows... but you can still do this without javascript (combining the two to provide a richer experience for the user is easy).

The data would only "live" as long as the page request (milliseconds). The data is never stored (in a database etc) and as such you shouldn't have any privacy for data privacy concerns.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Hi Again,

What are the environments in which ASP or PHP code can be developed? I am thinking like Visual Interdev, ASP.NET etc. I understand that I can just code in a text editor, but in case my resource wants to develop in a GUI environment, I would like to know the options. What are the things I should be asking my web host if we choose one of the GUI environments?

Thanks

Jino
 
The output for whatever-tool-you-develop-in will be a plain text file - at least for php and asp it will be. The host will need to run a php (or asp) interpreter to process the commands as pages are requested. PHP is free, which is why it's so widely supported. I don't know about ASP. The host won't need to know what tool(s) you're using to build the code.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top