Using Javascript / VBscript to create a simple form

Status
Not open for further replies.

Uchiha

Ars Scholae Palatinae
807
Can anyone help me with this homework? I am stuck and not sure how to proceed. Any websites with similar layouts that can help me do this assignment? Thank you!

The specific tasks are:

The user should be able to interact with 6 different types of fields on the HTML page.
1. six radio buttons (use different values for each radio; the first radio button is checked at load time)
2. four checkboxes (none of the checkboxes are checked at load time)
3. a select box with five options (the first option ("default value") is selected at load time)
4. one text box (initial value is a single blank; maximum of 30 characters; all visible)
5. one textarea (intial value is "default value"; five rows and 40 columns)
6. one button (label should read "EDIT and REPORT")

When the user finishes entering data and making selections, the button labelled "EDIT and REPORT" is to be pressed. The VBScript component of the page will then edit the data according to the editing rules below:
1. Six radio buttons
None.
2. Four checkboxes
At least one checkbox must be checked.
3. Select box
The user must select an option OTHER THAN the first one.
4. Text Box Edits
The field should be edited to remove any occurrences of the three characters: /, \ or *. Identify the number of characters the user entered into the field and the number of characters remaining after the edit.
5. Text Area
All blank spaces should be replaced with the + character. Remove all carriage returns and line feeds. Identify the number of characters entered into the textarea before and after the edit.

Report any editing omissions to the user (e.g., if the user fails to check a checkbox, isssue a message that says: "You must check at least one checkbox").

Once the user has successfully entered data and made choices, write an output report with the information on the editing results and other descriptive data (i.e., create the page "on-the-fly"). Specifically report for:

1. Radio Buttons
the name of the radio button
the value of each radio button
the radio button checked at load time
the radio button checked by the user
2. Checkboxes
the name of each checkbox
the names of all the checkboxes chosen by the user
3. Select Box
name of the Select Box
list all the options and their associated values
the index of the initial selection and its value
the index of the final user's selection and its value
4. Textbox
Name of the textbox
Original contents and length
User's entry before editing and its length
User's entry after editing and its length
5. Textarea
Name of the textarea
Original contents and length
User's entry before editing and its length
User's entry after editing and its length
 
Sounds like you're getting overwhelmed with different elements.

1. How are you going to implement this? What tools were you given? Any direction at all?
2. Do you know how to create an html form and handle GET/POST operations?
3. Once you have the first two handled, I would look up "javascript validation". Basically they're asking you to do form validation, which means you look at the user inputs for each form element and determine whether the input is valid. I can't actually tell if you're required to use one of Javascript or VBScript or if you have the option. If you have the option, go with Javascript. You'll find a lot more material online about Javascript.

One good place to start is http://w3schools.com
 

Uchiha

Ars Scholae Palatinae
807
gaijin":2gijows1 said:
Sounds like you're getting overwhelmed with different elements.

1. How are you going to implement this? What tools were you given? Any direction at all?
2. Do you know how to create an html form and handle GET/POST operations?
3. Once you have the first two handled, I would look up "javascript validation". Basically they're asking you to do form validation, which means you look at the user inputs for each form element and determine whether the input is valid. I can't actually tell if you're required to use one of Javascript or VBScript or if you have the option. If you have the option, go with Javascript. You'll find a lot more material online about Javascript.

One good place to start is http://w3schools.com

We are to use notepad to create the .htm page. I know how to create a basic form box but not get/post operations you mentioned. We are to actually do both java and vb. But I am not going to do both as I am already stuck. I will try java first like you said. Also thank you for the website.
 
Uchiha":1nsmzdvk said:
We are to use notepad to create the .htm page. I know how to create a basic form box but not get/post operations you mentioned. We are to actually do both java and vb. But I am not going to do both as I am already stuck. I will try java first like you said. Also thank you for the website.
Important distinction: it's javascript. Java is a different language. The same goes for VB and VBScript, I think. VBScript might be a subset of VB, I'm not sure. Never used it that much.

If all you're using is notepad to create an htm page, it sounds like you aren't expected to make anything on a server. In that case, I'd wager the instructor wants you to handle all of the assignment functionality with javascript. That's... actually I'm not that confident, I'd ask your instructor if you're expected to submit the form to a server or just do all of the form processing with javascript. It really sounds like they're asking you to do too much in one assignment. Or maybe I'm not seeing a simpler solution.
 
glenthas":2b1h3szc said:
It looks to me like he's supposed to create an html form with vbscript/javascript validation and then submit it to another html page where he, again using vbscript/javascript, writes out the data.
Oh, good point. I suppose he could do that on the same local machine. Silly me. For some reason, I was thinking he would have to do all of the form submission handling within the same html file and then rewrite the contents of the entire page dynamically.

I guess number one then would be to create an html form simpleForm.htm that submits to another html form called processForm.htm and learn how to handle GET or POST information in javascript...

Though you have to admit, that sounds like an odd exercise. For the most part, you'd never do form processing with javascript. Validation, yes, but the actual processing? Weird.
 

Delirious

Wise, Aged Ars Veteran
172
From the assignment description given in the OP, it sounds like a pure validation exercise rather than ouputting any data entered into the form, for the most part anyway. The last section does sound like it wants the entered data to be output, but instead of using GET/POST, specifically with using Javscript, you could always create a child window and have the entered information in that new window, instead of creating another page just to display the output. Seems much simpler.

Probably because I have NEVER heard of using client-side scripting to process GET/POST data.
 
Status
Not open for further replies.