View Full Version : Extending Functionality of an Email form
Hagopm
09-17-2004, 07:25 AM
Hiya guys
I've written an email form for a website. Its a timesheet form so students for a tutoring agency can fill in timesheets on line. its up at
http://www.oc-ec.com/pages/tut_tmform7.htm
I've got a few queries, I've tried finding the info online but I've yet to find a comprehensive guide to writing forms, all the attributes etc. so if anyone knows of one please give me the address. Else I'll have to buy a book.
On my form I'd like to do the following:
The hours columns to be added up and the number placed in the 'Total Hours' box
this number to be multiplied by 26.5 (the hourly rate tutors are paid) and placed in the 'Tutor Fee' Box
this number added to whatever number is placed in the travel fees box and the result placed in the Grand Total Box.
Also, when the email generated by the form is received, the textfield vales are in a different order every time. Is there any way to constrain the order, to guarantee that the textfield values in the email are the same order as they are on the form?
thanks
---------------
btw attachment is an unrelated cool image!
Gamini
09-21-2004, 06:56 AM
I attempted this with javacript with no luck (I was never very good with it though). Can the totals and everything come on the screen after the submit button is pressed? Or does it hve to come before that?
If its after, then I can easily do the script for you using php. Your host will have to support it though.
The text field orders come that way because they all have the same name. You must name them diferently for them to come in order.
Hagopm
09-23-2004, 07:42 PM
I suck at coding full stop! Thats why I stick to HTML!
How about a calculate button instead of the submit button? I'd be grateful for the script, pretty sure my host supports PHP.
pretty sure I named the textfields, will have another look tomorrow.
thanx
Hagop
Gamini
09-25-2004, 11:36 AM
Ok, I will post that script maybe tomorrow.
Hagopm
10-14-2004, 04:28 AM
yo dude
any chance you could post that script?? I'd much appreciate it, and if I use it I can pay you something for your time!;)
123456789
10-17-2004, 07:18 AM
I'll take a look too.
Hagopm
10-17-2004, 12:10 PM
sweet! the more the merrier
123456789
10-17-2004, 05:40 PM
You know where it says "Lesson Times" (hours and minutes) and the "hours"? What does each represent?
Hagopm
10-18-2004, 08:02 AM
'Lesson times' is the time of day of the lesson e.g.
14:00.
'Hours' is the length of the lesson e.g. 2
hours is the only value that needs to be affected by the script.
123456789
10-18-2004, 02:08 PM
Also, for the travel costs and the Grand Total and stuff like that, you can fill those in later. And I think I'll have to put a Calculate button on the form and then have the grand totals and stuff on another page, or make an I-Frame.
123456789
10-18-2004, 02:13 PM
Also, I'm not a genius, so I might take a while.
123456789
10-18-2004, 02:16 PM
How do you calculate the Tutor Fee, the Travel Costs, and Grand Total?
123456789
10-18-2004, 03:51 PM
And if Ian is here, I'm sorry for the multiple posts, because I didn't read my PM's until right now.
Hagopm
10-18-2004, 06:20 PM
tutor fee is 'total hours' x 32.96
dont worry about travel costs or total fee as these are discretionary.
I just need the hours added up, and then the tutor fee
Ideally the answers would appear in the appropriate textfield boxes on the page when the 'calculate' button is pressed... 2nd best would be an i-frame
cheers
123456789
10-19-2004, 06:08 AM
I should be done soon. Are you urgent?
Gamini
10-19-2004, 07:49 AM
The hours added up and everything using php cannot be placed inside the textbox, they can just be plain text.
If that is ok then I can post the script within a few hours.
123456789
10-19-2004, 12:32 PM
What? You can post numbers inside text boxes using PHP.
123456789
10-19-2004, 02:05 PM
Well, I guess if Gamini is going to post it, I'll stop, because his script is probably going to be better than mine anyway.
You can put PHP variables in text fields:
like this:
<?
$testing = 3;
?>
<form>
<input type="text" value="<? $testing ?>">
</form>
Gamini
10-21-2004, 07:28 AM
I have done the majority of the script, I will post it with all errors corrected sometimes within the next 24 hours.
123456789
10-21-2004, 03:49 PM
Do you have an i-frame or does it automatically update when you type something into a text box?
123456789
11-09-2004, 05:25 PM
Hey! I just figured it out with JavaScript:
<script language="javascript" type="text/javascript">
<!--
function calculate(f){
total = eval(f.amount1.value) + eval(f.amount2.value) + eval(f.amount3.value) + eval(f.amount4.value);
document.getElementById('total').innerHTML=total;
document.getElementById('total2').value=total;
}
//-->
</script>
Name the input boxes with the correct names and change the script as you would like it.
123456789
11-26-2004, 09:24 AM
Does anyone know how I can get Hagopm to come back to this thread?
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.