Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form buttons 1

Status
Not open for further replies.

mwebbo1

Technical User
Jul 11, 2002
71
US
I am using a aspmailer(I think) for a form but I want my button not to be the standard buttons. Text, or anyother good ideas, I tried some JavaScript and it would not work.
<code>
<a href=&quot;javascript:document.theForm.submit();&quot;>Submit</a>
</code>

Thanks!
 
this way
<a href=&quot;#&quot; onClick=&quot;theForm.submit();&quot;>Submit</a>
You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
for images reference this thread from earlier today
thread216-331100 You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
Do you mean I should just put it in like that, or what should the # be?

<a href=&quot;#&quot; onClick=&quot;theForm.submit();&quot;>Submit</a>
 
yes just like that. You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
I can't get it to work, it processes and goes to the page I want, but no email is recieved
 
is the reciepient field in the form etc. what is processing the form. What method are you posting the form GET or POST.
This isn't due to the way you are submiting the form. If the email is not being sent out then there is something either wrong in the script that processes the form and email it or something else is missing. You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
ok...here is the code that I am using////
<code>

<%
dim email
'dim body, confirmsg, action, recipient, subject, from, fromem
'dim name, title, company, address, city, state, zip, areacode
'dim phone, fax, how_they_heard, i_see
'dim comments


action = request(&quot;action&quot;)

if action = &quot;send&quot; then



email = request(&quot;email&quot;)


recipient = &quot;webmaster@uliad.com&quot;
subject = &quot;Add Me!&quot;
from = request(&quot;name&quot;)
fromem = request(&quot;email&quot;)



body = body & email & chr(10)


SendMail recipient, body, subject, from, fromem
confirmsg = &quot;<font face=verdana,arial,helvetica color=A0522D size=2> Thank you.</font>&quot;

end if

sub SendMail(sRecipient, sBody, sSubject, sFrom, sFromem)

'on error resume next
Dim oEmail
Dim i

set oEmail = Server.CreateObject(&quot;SMTPsvg.Mailer&quot;)

oEmail.RemoteHost = &quot;mail.domain.com&quot;
oEmail.FromAddress = sFromem
oEmail.Subject = sSubject
oEmail.AddRecipient sRecipient, sRecipient
oEmail.BodyText = sBody
oEmail.SendMail

response.write oEmail.Response

set oEmail = nothing

end sub

%>

<html>

<head>


<title>Uliad Newsletter</title>
</head>

<body bgcolor=&quot;#ffffff&quot; link=&quot;#585858&quot;>
<% if action = &quot;send&quot; then %>
<tr>
<td align=&quot;left&quot; width=&quot;100%&quot;><font color=&quot;navy&quot; face=&quot;arial,verdana,helvetica&quot;
size=&quot;2&quot;><strong>Thanks...you are now added to our mailing list!</strong><br>
<a href=&quot; target=&quot;_parent&quot;><font color=&quot;#000000&quot; face=&quot;verdana,arial,helvetica&quot;
size=&quot;2&quot;>Return to the Home Page</font></a></font></td>
</tr>
<% else %>
<td valign=&quot;top&quot; align=&quot;left&quot;><font color=&quot;#a0522d&quot; face=&quot;verdana,arial,helvetica&quot; size=&quot;2&quot;> </font>




<form method=&quot;post&quot; action=&quot;form1.asp&quot;>
<input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;send&quot;>
<table cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; border=&quot;1&quot; align=&quot;left&quot;>
<tr>
<td valign=&quot;top&quot; align=&quot;left&quot;>
<FONT color=#000000>
<FONT face=verdana,arial,helvetica size=2>
<STRONG>Email:</STRONG></FONT>
</td>
<td align=&quot;left&quot;><FONT face=verdana,arial,helvetica
size=2><INPUT name=email size=30></FONT></td>
</tr>
<tr>
<TD colspan=&quot;2&quot; align=center><br><INPUT type=submit value=&quot;Submit&quot;><INPUT type=reset value=&quot;Clear&quot;></TD></TR>
</table>

</form>
<% end if %>
</td></TR></TABLE>
</body>
</html>

</code>

It is coming in a little messy, but hopefully you can see what is going on.
 
OK...as you can see I changed a little after I saw the code but it works. I added the clear link also. as you see I have a grayed out image way of doing this also I left in there for you if you want to try that also.
You needed to give the form a name as well to make this work as you see below

<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;form1.asp&quot;>
<input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;send&quot;>
<table cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; border=&quot;1&quot; align=&quot;left&quot;>
<tr>
<td valign=&quot;top&quot; align=&quot;left&quot;>
<FONT color=#000000>
<FONT face=verdana,arial,helvetica size=2>
<STRONG>Email:</STRONG></FONT>
</td>
<td align=&quot;left&quot;><FONT face=verdana,arial,helvetica
size=2><INPUT name=email size=30></FONT></td>
</tr>
<tr>
<TD colspan=&quot;2&quot; align=center><br>
<!-- <input type=&quot;image&quot; name=&quot;submit&quot; border=0> -->
<a href=&quot;javascript:document.form1.submit()&quot;>Submit</a>
<a href=&quot;javascript:document.form1.reset()&quot;>Reset</a>

<!-- <INPUT type=reset value=&quot;Clear&quot;> -->
</TD></TR>
</table>
</form>

hope that helps you You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
ok...great, that was it, I really appreciate your sticking with me on this. Now if only the Red Sox can pull it off in the last inning!
 
One quick note on the text link, if you are using IE 5.0 you cannot submit the form directly, I can't remember the reason behind it. What you have to do is do a setTimeout for any amount of time greater than 0. What I usually end up doing (just to be safe and compatible) is for IE browsers I create a function to submit a form like so:
<script>
function textSubmit(frmObjName){
setTimeout(frmObjName+&quot;.submit()&quot;,1);
}
</script>
A little messy, but I originally got the code from a microsoft workaround they had built into explorer early on for the media player, in that case it would crash explorer without the slight pause. (heh, the comment basically said &quot;I don't know why this works, but it does, don't remove it&quot; :p)
-Tarwn
------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top