http://onepotcooking.com/keiyanwat/class5/class4_inclass_v3.html
I figured out why the method="post" didn't worked in the form in version one and two. In the code, my submit button had the wrong code. The original version had set the type="button" in the <> tag of the submit button. After check with W3C school's example again, I found out the type should be set to < type="submit" value="Submit">, in order for the method="get" to work. I got confused because the type="..." for the other things are very descriptive like type="text" for a input text box, type="checkbox" for a checkbox and type="radio" for a radio button. So I had thought a submit button should be type="button". But that was not it. The code:
< type="submit" value="Submit">
actually refers to what will the form do to the data the user inputted after clicking on the button. I guess this is beginning to make a bit more sense but the form has always seemed a bit too confusing to me. I guess I'll just keep going back to the tutorial until the concepts finally gels in my brain.
Thank you + Class 4 In class assignment version 2
This week's review of the use javascript is better paced and explained.
So in an attempt to re-do the in-class assignment from last week, here's version #2:
http://onepotcooking.com/keiyanwat/class4/class4_inclass_v2.html
The check box is activated to copy the information from billing to shipping on check and to clear the shipping info when un-checked. Actually the clearing of the shipping info was a problem because I didn't know how to write the else statement problem. I tried writing it as:
else (checkElId.uncheck) {
document.getElementById('shipFirst').value =a .new value }
but I keep getting a syntax error for that part. I didn't even know the proper syntax for assigning a new value. So I solved the problem by looking at today's class basics lesson files. I made it work by defining a new variable, under the else statement, called nothing and have the value of nothing to be a blank string, like this:
var nothing = " ";
Then I just assigned the values of the shipping data to equal to the variable, nothing. And it worked! Here's the else statement block:
else {
document.getElementById('shipFirst').value = nothing;
document.getElementById('shiplast').value = nothing;
document.getElementById('street2').value = nothing;
document.getElementById('city2').value = nothing;
document.getElementById('state2').value = nothing;
document.getElementById('zip2').value = nothing
Now the shipping info is clear when the else statement if triggered. Yay!!! I guess next is to figure out how to get the info submitted into the navigation bar but not before doing the inclass from this week. I don't want to fall behind again.
No comments:
Post a Comment