Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 37
Trades: 0
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
 
 
Register now for full access!
Old 07-22-2004, 11:23 AM hi
Mooofasa's Avatar
Defies a Status

Posts: 1,611
Name: Michael (mik) Land
Location: England
Trades: 0
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
__________________

Please login or register to view this content. Registration is FREE
- Tumblog with thoughts, quotes, links, videos, images and my creations.

Please login or register to view this content. Registration is FREE
- The best free web browser.

Please login or register to view this content. Registration is FREE
- Firefox is now Firefail.
Mooofasa is offline
Reply With Quote
View Public Profile Visit Mooofasa's homepage!
 
Old 07-27-2004, 06:08 AM
Experienced Talker

Posts: 37
Trades: 0
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, 05:53 AM
wbmstr2good's Avatar
Average Talker

Posts: 22
Trades: 0
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, 09:58 AM
ACW
Average Talker

Posts: 26
Trades: 0
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 .
__________________

Please login or register to view this content. Registration is FREE
by Geo Redundant Hosting
ACW is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Auto fill forms
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
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.30746 seconds with 12 queries