logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 12-09-2011, 01:18 AM   #1
pauldf
 
Join Date: Feb 2010
Posts: 48
Default Form question

Hi Guys

I hope this is the right place to post this question. A friend of mine did up this script for me, my ones are usually done in dreamweaver/php, form insert etc., I think he built this in/using jquery. I'll hold my hands up here and say I'm only starting into the jquery side of things and my knowledge is fairly limited. Unfortunately I won't be able to get in touch with my friend who did this up for about 4 - 6 weeks (he's off traveling). I have been trying to dig through the code to see will anything stand out but the more I look at it the worse the brain gets.

I just have a few questions if someone can help me. The first thing I noticed is there is no "action" in the top line of the form id

HTML Code:
<form id="contact-form" enctype="multipart/form-data" method="post" >
Is this an over sight by him or is this the way these forms work and if so how do you tell it to go to the php action script? Or is there some other way it works when someone clicks submit. Here is the form that he did up:

HTML Code:
<form id="contact-form" enctype="multipart/form-data" method="post" >
<fieldset>
												<label>
													<span class="name-input">Name:</span>
													<input name="name" value="" onBlur="if(this.value=='') this.value=''" onFocus="if(this.value =='' ) this.value=''" />
												</label>
												<label>
													<span class="name-input">Email:</span>	
													<input name="name1" value="" onBlur="if(this.value=='') this.value=''" onFocus="if(this.value =='' ) this.value=''" />
												</label>
												<label>
													<span class="name-input">Message:</span>
													<textarea name="message" onBlur="if(this.value=='') this.value=''" onFocus="if(this.value =='' ) this.value=''"></textarea>
												</label>						
											</fieldset>
											<div class="link-form">
												<a class="link link-margin" href="#" onClick="document.getElementById('contact-form').reset()">Clear</a>
												<a class="link" href="#" onClick="document.getElementById('contact-form').submit()">Send</a>
											</div> 
											<div class="clear"></div>		
										</form>

One other thing, in the script he has things like...if(this.value==' ')... am I meant to fill in values for these or is that the way this script works. To be honest here guys like I said I am fairly limited when it comes to this, so if you guys reckon it would be to much for me to get my head around, I will just throw out his script and put in one of my ones...it won't look as pretty but at least I know it'll work

Any advice would be much appreciated, thanks for taking the time to read this.

All the best.
pauldf is offline   Reply With Quote
Old 12-09-2011, 02:49 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

is there a onSubmit action perhaps?
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 12-09-2011, 03:04 AM   #3
pauldf
 
Join Date: Feb 2010
Posts: 48
Default

Hi edbr

Thanks for getting back. No that is whats getting me. I went looking through everything and I can't see anything that tells the form what to do once someone clicks submit. The only thing I have seen is the piece of code that has the onClick part in it. It looks like there is a space for a link "href"

HTML Code:
<div class="link-form">
												<a class="link link-margin" href="#" onClick="document.getElementById('contact-form').reset()">Clear</a>
												<a class="link" href="#" onClick="document.getElementById('contact-form').submit()">Send</a>
											</div>
But that wouldn't be where to put the link to the handling form would it. I'm beginning to think that something like "Action=" or "onSubmit" must have been left out of the script. Thanks again for getting back.
pauldf is offline   Reply With Quote
Old 12-09-2011, 03:41 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

add an action and see what happens , thtas waht i would do, just test it
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 12-10-2011, 01:26 PM   #5
pauldf
 
Join Date: Feb 2010
Posts: 48
Default

Hi edbr

Okay I think I may be on to something. I spent ages going through line after line to see could I see what was going on, or where I could put in the action. And i just decided to try add in:

HTML Code:
form action="contactform.php"
just before the form id and at least when I click submit now, its starting to look for the php script to send the form. I just did up a simple php script to test the submit button, so I'm gonna do up a more secure one later with validation checks etc. and run it and see will it work for me. If it does happy days...if not I can see my computer going flying out the window

Thanks again for your posts I'll let you know how it goes.
pauldf is offline   Reply With Quote
Old 12-12-2011, 12:13 PM   #6
pauldf
 
Join Date: Feb 2010
Posts: 48
Default

Okay just a quick update I just added "form action" to the code and pointed it at my php script and it seems to be working fine now, happy days
pauldf is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:01 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com