Forums | MacLife
You are not logged in.
#1 2008-11-19 2:15 pm
- Title27GT
- Member

- From: New York, NY
- Registered: 2007-07-10
- Posts: 338
Rating Box
Gentlemen/women,
I would like to have an HTML form on my webpage where visitors could rate certain people on their performance. I'd like to have a box where you put your name, a drop-down where you select the person you're rating, and a box for additional comments. I would like the results e-mailed directly to me. Now, everytime I've attempted this, the form has gotten screwed up and when I press "submit" it opens up Apple Mail. Could someone draft up a code for me?

Offline
#2 2008-11-19 4:33 pm
- sturner
- Royal High Poobah
- Moderator

- From: Carrollton, TX USA
- Registered: 2000-01-31
- Posts: 13795
Re: Rating Box
like in a perl script. This is a bit more arcane than i can comfortably accomplish, though I understand the principles behind it. You need more dohickies.
I'm not dead yet.
There are 3 types of people, those who can count and those who can't.
"There are few things graven in stone, excepting your date of death."
Offline
#3 2008-11-19 4:51 pm
- Title27GT
- Member

- From: New York, NY
- Registered: 2007-07-10
- Posts: 338
Re: Rating Box
sturner wrote:
like in a perl script. This is a bit more arcane than i can comfortably accomplish, though I understand the principles behind it. You need more dohickies.
Wish I knew what the hell a perl script was.

Offline
#4 2008-11-19 5:08 pm
- sturner
- Royal High Poobah
- Moderator

- From: Carrollton, TX USA
- Registered: 2000-01-31
- Posts: 13795
Re: Rating Box
there are lots of books on it. Google it, you can find free editors for it too.
I'm not dead yet.
There are 3 types of people, those who can count and those who can't.
"There are few things graven in stone, excepting your date of death."
Offline
#5 2008-11-19 5:44 pm
- Title27GT
- Member

- From: New York, NY
- Registered: 2007-07-10
- Posts: 338
Re: Rating Box
sturner wrote:
there are lots of books on it. Google it, you can find free editors for it too.
All that for basically a suggestion box? Holy cow.

Offline
#6 2008-11-19 6:16 pm
- Macskeeball
- Member

- Registered: 2002-02-07
- Posts: 8014
- Website
Re: Rating Box
Yes, you need a server-side scripting language of some sort for that. Another one is PHP. You might want a database for it as well.
tech writer for hire
Offline
#7 2008-11-19 6:56 pm
- Title27GT
- Member

- From: New York, NY
- Registered: 2007-07-10
- Posts: 338
Re: Rating Box
This is all way over my head. Forget it.

Offline
#8 2008-11-20 7:18 pm
Re: Rating Box
If you're sending via e-mail, you need nothing server-side.
You basically need a custom mailto: link. See here.
The simplest way is to write a bit of Javascript that will concatenate form strings on submit. Psuedocode:
Code:
window.open("mailto:?subject=Rating&body=Rater's Name: "+forms[0].input[0].value+"\nRatee's Name: "+forms[0].input[1].value+"\nComments: "+forms[0].input[2].value);No, I'm not going to write everything for you; you need to learn for yourself. I've given you all the tools.
Last edited by Basseq (2008-11-20 7:19 pm)
Basseq is me, John Whittet.
(Finishing the remainder of the thought expressed in the post has been left as an exercise for the reader.)
Offline
#9 2008-11-20 7:20 pm
- Title27GT
- Member

- From: New York, NY
- Registered: 2007-07-10
- Posts: 338
Re: Rating Box
Basseq wrote:
If you're sending via e-mail, you need nothing server-side.
You basically need a custom mailto: link. See here.
The simplest way is to write a bit of Javascript that will concatenate form strings on submit. Psuedocode:Code:
window.open("mailto:?subject=Rating&body=Rater's Name: "+forms[0].input[0].value+"\nRatee's Name: "+forms[0].input[1].value+"\nComments: "+forms[0].input[2].value);No, I'm not going to write everything for you; you need to learn for yourself. I've given you all the tools.
The problem I was having with mailto links was that instead of sending the results to my e-mail address, it opened up the user's mailing application. Are you sure I don't need any CGI?

Offline
#10 2008-11-20 8:43 pm
- Macskeeball
- Member

- Registered: 2002-02-07
- Posts: 8014
- Website
Re: Rating Box
Basseq's form of mailto would open the user's email client, with the subject and message content automatically filled in based on the form. The user would then send the email to the email address you provided.
tech writer for hire
Offline
#11 2008-11-21 1:06 am
- dv
- Negusa Negest
- Moderator

- From: Minneapolis, MN
- Registered: 1999-08-30
- Posts: 18092
Re: Rating Box
Which is great, except for the 2/3 of us using webmail.
"Now commences the process of cutting off the head, which generally takes from an hour to an hour and a half by an expert workman with a sharp blade." -Reuben Delano, Wanderings and Adventures
Offline
#12 2008-11-21 2:20 am
- Macskeeball
- Member

- Registered: 2002-02-07
- Posts: 8014
- Website
Re: Rating Box
Yep, although I'm part of that 2/3 and I have my computer set to use Gmail's webmail as the default email handler with Google Notifier. Many probably don't have that, but it is possible.
tech writer for hire
Offline
#13 2008-11-21 6:07 am
- Title27GT
- Member

- From: New York, NY
- Registered: 2007-07-10
- Posts: 338
Re: Rating Box
Yeah, the whole problem was that Mailto was opening up people's mail clients, which I don't want to happen. Back to the drawing board.

Offline
#14 2008-11-21 11:18 am
- Macskeeball
- Member

- Registered: 2002-02-07
- Posts: 8014
- Website
Re: Rating Box
Title27GT wrote:
Yeah, the whole problem was that Mailto was opening up people's mail clients, which I don't want to happen. Back to the drawing board.
If you want to do this sort of thing without opening people's mail clients, then you need something server-side such as PHP or Perl, and possibly a database such as MySQL or SQLlite. I know you think this sounds hard, but in reality these sorts of things can really make web development a lot easier, and I'm not just talking about web forms. Static web sites, which are the kind of site you're currently making, are a major pain in the butt to maintain/modify. Much of the modern web would be impossible without dynamic web development.
Last edited by Macskeeball (2008-11-21 11:23 am)
tech writer for hire
Offline
#15 2008-11-21 11:34 am
- mrreet2001
- Member

- From: NW Ohio
- Registered: 2005-05-25
- Posts: 4334
- Website
Re: Rating Box
he should be able to use a php file and a text document ... wouldn't he?
2.66Ghz QuadCore-Nehalem w/24"LED CD ---2.2Ghz BlackMB---15" 2.4Ghz MBP(work)
Dual 2.3Ghz G5 (4G Ram, 2x 250G HD)(10.5 server)--- 400Mhz G4 PM (10.4 Server)
1.5GHz Powerbook---1.6Ghz G5 iMac
"So he fels down in a poisoning gas."
Offline
#16 2008-11-21 11:42 am
- Macskeeball
- Member

- Registered: 2002-02-07
- Posts: 8014
- Website
Re: Rating Box
mrreet2001 wrote:
he should be able to use a php file and a text document ... wouldn't he?
That had me puzzled at first because a PHP file is a text document, but then I realized you meant a text document instead of a database. Sure, that can be done, but using a database to store the data in would probably be easier than writing a parser, and would probably scale better.
tech writer for hire
Offline
#17 2008-11-21 12:24 pm
- mrreet2001
- Member

- From: NW Ohio
- Registered: 2005-05-25
- Posts: 4334
- Website
Re: Rating Box
yeah sorry ...
I was just thinking along those lines because someone could write the php code for him and he would just have to up load the php file and the txt database file and chmod em ... which would be a lot easier for Title27 ... unless of course he has Database experience and a free database.
2.66Ghz QuadCore-Nehalem w/24"LED CD ---2.2Ghz BlackMB---15" 2.4Ghz MBP(work)
Dual 2.3Ghz G5 (4G Ram, 2x 250G HD)(10.5 server)--- 400Mhz G4 PM (10.4 Server)
1.5GHz Powerbook---1.6Ghz G5 iMac
"So he fels down in a poisoning gas."
Offline
#18 2008-11-21 3:16 pm
- Title27GT
- Member

- From: New York, NY
- Registered: 2007-07-10
- Posts: 338
Re: Rating Box
Macskeeball wrote:
Title27GT wrote:
Yeah, the whole problem was that Mailto was opening up people's mail clients, which I don't want to happen. Back to the drawing board.
If you want to do this sort of thing without opening people's mail clients, then you need something server-side such as PHP or Perl, and possibly a database such as MySQL or SQLlite. I know you think this sounds hard, but in reality these sorts of things can really make web development a lot easier, and I'm not just talking about web forms. Static web sites, which are the kind of site you're currently making, are a major pain in the butt to maintain/modify. Much of the modern web would be impossible without dynamic web development.
You're right, it is a pain in the neck, but this is a non-money related organization which makes it impossible for me to pay for any sort of web development services and leaves me forced to code things from the ground up from nothing but HTML and occasionally CSS.

Offline
