Reply
Auto fill forms
Old 07-21-2004, 09:35 AM Auto fill forms
Experienced Talker

Posts: 37
ive got an online system which allows people to enter info into a database about an absence request they have - at the same time this emails the person in charge of absences.

The form is setup now but to make it easier i want to alter the "Name" and "email" fields so they require no filling in ie - a staff members name will be chosen from a drop down list (ive done this bit fine) and then once this is done the relevant email for this person is automatically placed in the email field. This bit i am struggling with - anyone any ideas how this can be done??

Thanks!

PS: ive done this system using asp pages
woody22 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 07-22-2004, 10:23 AM hi
Mooofasa's Avatar
Defies a Status

Posts: 1,612
Name: Michael (mik) Land
Location: England
I believe you can do this by using DHTML, PHP or Javascript. If you can the answers might be here:
www.dynamicdrive.com
www.javascriptkit.com
www.w3schools.com


Mik
__________________
Tumblings.co.uk - Tumblog with thoughts, quotes, links, videos, images and my creations.
Opera Browser - The best free web browser.
Opera Dev Tools - Firefox is now Firefail.
Mooofasa is offline
Reply With Quote
View Public Profile Visit Mooofasa's homepage!
 
Old 07-27-2004, 05:08 AM
Experienced Talker

Posts: 37
thanks for that mik!

Ive come up with this too:

Code:
function mail()
if firstname.value="Gary Rodgers"
then
emailfieldname.value="grodgers@wickersley.net";
else if
firstname.value="Paul Worsnop"
then
emailfieldname.value="pworsnop@wickersley.net";
end if
end


%>
but this makes the browsers come up with the following error message:

Code:
Microsoft VBScript compilation error '800a03f9' 

Expected 'Then' 

/AbsenceForm/Absence.asp, line 24 

if firstname.value="Gary Rodgers"

whats wrong with my code???

Woody
woody22 is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 04:53 AM
wbmstr2good's Avatar
Average Talker

Posts: 22
You "If Condition Then" needs to all be on one line. You can't span multiple lines of code with one if statement. (without using the _ feature)
wbmstr2good is offline
Reply With Quote
View Public Profile
 
Old 08-13-2004, 08:58 AM
ACW
Average Talker

Posts: 26
Hello Woody,

Like wbmstr2good stated, the Then has to be on the same line as the If. Also note that Else If in vbscript is one word, you do not end the line with ; and you must end the function with End Function. So your code should look like this...

Code:
<%
function mail()
    if firstname.value="Gary Rodgers" then
        emailfieldname.value="grodgers@wickersley.net"
    elseif firstname.value="Paul Worsnop" then
        emailfieldname.value="pworsnop@wickersley.net"
    end if
end function
%>
This is all assuming that you are trying to run the code on the server and not the browser. Seeing things such as firstname.value makes me feel you are trying to either run this on the browser (for which you should use javascript and therefore my code above is all wrong) or you are hoping that firstname.value on the server will set that value on the form, but it doesn't work that way.

I hope that makes some sense .
__________________
Affordable Business Web Site Hosting by Geo Redundant Hosting
ACW is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Auto fill forms
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12505 seconds with 12 queries