PDA

View Full Version : Help w/ Forms



buzzy1
01-06-2005, 12:56 PM
Hey, I'm new here.

My question is: Is there anyway to create a form that has a Submit button that once clicked, emails the info entered in the form to a specific email address?

Thanks for your help!

simonf
01-06-2005, 01:11 PM
Hi

YES...

You will need to do a couple of things, also ensure your host provides this service:

1)In the header just under META tag place the following lines and modify

<FORM NAME=test METHOD=post ACTION=http://www.yourhost.com/pubscripts/formmail.asp>
<INPUT TYPE=hidden NAME=MailTo VALUE=info@youremailaddress.com>
<INPUT TYPE=hidden NAME=Subject VALUE='Website Information Request'>
<INPUT TYPE=hidden NAME=ReturnURL VALUE=http://www.yourhost.com/thanks.htm>

2) In the body of the form place your form fields and on the submit button ensure it looks roughly like this <input type="submit" value="Submit" v:shapes="_x0000_s1069" tabindex="15">

A working example if required: http://www.smos.co.za/request.htm

rgds,simonf :cool:

mwinter
01-06-2005, 02:14 PM
You will need to do a couple of things, also ensure your host provides this service:I would think that instructing the OP to look for a form mail service is about all that's necessary. Any other instructions would depend on the service used.


1)In the headerExcuse me? It's entirely invalid to place a form element anywhere other than within the body element of a document.


<FORM NAME=testI don't see any need to name the form. Moreover, the name attribute should only be used if backward compatibility with ancient browsers like NN4 is desired (or required). The id attribute should be used instead.


<INPUT TYPE=hidden NAME=MailTo VALUE=info@youremailaddress.com>If attribute values contain any characters other than letters, digits, hyphens, periods, underscores or colons, they must be quoted. This applies to the ReturnURL input element below, too.


<INPUT TYPE=hidden NAME=Subject VALUE='Website Information Request'>
<INPUT TYPE=hidden NAME=ReturnURL VALUE=http://www.yourhost.com/thanks.htm>That is entirely subjective and may have no relevance to the OP at all.


<input type="submit" value="Submit" v:shapes="_x0000_s1069" tabindex="15">Simply

<input type="submit" value="Submit">would be more correct.


A working example if required: http://www.smos.co.za/request.htmI am certain that works only as a fluke. That form must contain the form controls. It does not belong in the head of a document. As soon as a user agent encounters the form element, it should assume that the head element has ended and the body element has begun (the starting and closing tags of both the head and body elements are optional).

I strongly suggest you correct that mark-up (validation results (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.smos.co.za%2Frequest.htm)).

Mike


[edit: typo]

simonf
01-07-2005, 05:18 AM
Well strange at it may seem Mike, my fluke works on many web sites not only my own, and as I got this bit of code my my service provider and they have a few hundred thousand users.. I kind of believe them... on looking at other sites they seem to have the same code in the head as well. Simonf

mwinter
01-07-2005, 09:27 AM
Well strange at it may seem Mike, my fluke works on many web sites not only my ownSo in other words, you're saying you can't be bothered to correct your erroneous mark-up?


on looking at other sites they seem to have the same code in the head as well.Of the millions of pages that include forms, I would expect that well over 95% have them in the body element where they belong.

For goodness sake, use your common sense.

Mike

Could you point to your service provider's instructions? I'm intrigued.


[edit: missed a point]

simonf
01-07-2005, 12:07 PM
HI Mike

I appologise... on checking the e-mail is just say the first four lines of the form should be as stated, not their position. So whilst my fluke works you are correct.

Thanks mate for pointing this out...... rgds,Simonf:cool:

mwinter
01-07-2005, 01:02 PM
on checking the e-mail is just say the first four lines of the form should be as stated, not their position.Whilst service providers aren't the best source of information when it comes to authoring (most of the information I've seen is out-dated), I'd be shocked if they were to make such a big mistake.


So whilst my fluke worksI would guess that when the submit button is activated, the user agent would realise that whilst the button isn't contained within a form, there is only one form in the document so it must be the right one. This is a reasonable assumption (though still, don't rely on it - a user agent shouldn't have to error correct anything). However, it's a big leap (in my opinion) for the user agent to add the other form controls that aren't explicitly contained during submission.

If you've ever received blank messages, this could be the reason why.


Thanks mate for pointing this outYou're welcome. :)

Mike