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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp forms? 1

Status
Not open for further replies.

Sidro

MIS
Sep 28, 2002
197
US
HI,
I am writing an asp program to write out an html form field, that has a username text field, password text field,
and also wrote in values for the username and password field; and also I have a submit button. My question is, how do I get asp to invoke the submit button after it has written the html form? Im trying all sorts of stuff like,
response.redirect, javascript(Javascript is clientside) I would like to do it in serverside if possible. Thanks.
 
Does this mean you are trying to get info from an HTML to an asp..? or the other way round..
Could you provide the code..so we could understand the logic you are trying to do...
Look for tips on aspin.com and 4guysfromrolla.com
Those sites are awesome.
 
hi,

What Im trying to do is make an automatic login for my email accounts.

"Does this mean you are trying to get info from an HTML to an asp..? or the other way round.."

I already have the values nicely processed and ready to be insert back into the username and password text field. Once I do that, I am going to post it to another page.
I could just have asp write a submit button. Then users will have to click on it. My question is, how do I get asp to invoke the subit button? Or is there another way of posting back that doesnt involve user interaction.

 
Is it some thing like "sign me automatically" option in hotmail? if it is then write a cookie with user detial and retrive them in login page, if cookie doesn't exist then allow user to enter their username and password. i haven't got any ASP editor with me, or else i could have helped with code.

kris
 
From what I understand is you want to take the Username/Password on to the next page without any user interaction.
If this is the Scenario then try the following -
Write a OnBlur Fucntion for the Password field
And the OnBlur Function could have a javascript that can call an asp which can carry over your values to any page you want.
I think to carry over values you might be thinking of using Session Variable or Query Strings..
Hope this helps...
Good Luck.
 
"i haven't got any ASP editor with me, or else i could have helped with code.
"


I can't believe you don't have notepad on your system... hmm





Sidro
"HI,
I am writing an asp program to write out an html form field, that has a username text field, password text field,
and also wrote in values for the username and password field; and also I have a submit button. My question is, how do I get asp to invoke the submit button after it has written the html form? Im trying all sorts of stuff like,
response.redirect, javascript(Javascript is clientside) I would like to do it in serverside if possible"



Sidro, Can you explain this a little better. I'm afraid you may not be asking for what you're really looking form...

[sup]The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee....
 
Hi decojute,
I apologize if my question is confusing for you. I was being concise and thought it was understandable. However, I know now that it isnt. So let me take a second shot at it.

Here is my situation. As you may know already, when you sign up for webhosting, you have the option of creating many email accounts. You know, like pop3,Imap,Smtp, and sometimes its web-based also.

Now thats great, I thought. However, after carefully examing it, Id realized that I dont have much control over it. For instance, I cant customize the look and feel of the inbox and login page, or code my own user validations. Therefore, I cant integrate it with my website so that it looks smooth and seamless.

The best and easy way, I think, would just to go buy and install my own mail server program. But thats alot of money for me. Im just going to take what I already have, applied some codes here and there, to see what I can get it to do.

Ok, so I cant customize the inbox page, but I can put the login text field and buttons onto my page. That way users can login from my page. And so, I put the login fields into my page. And it works. However, everytime a user type in the wrong username and password, it redirect them to the original login page and ask them to check for errors.
Now thats ugly. Remeber, the challenge is to make the process look smooth and seamless as possible.

To prevent it from redirecting users to its original login page, I thought maybe I can use asp to validate the username and passwood first before posting. The validating process will have to be done in the server-side. Therefore, using javascript is out of that question.

My scenerio,
The user comes to my page. The users input their username, password, and press the submit button. The submit button will not post to the form action, instead, it will take the inputs and give it to asp, to validate the username and password. If the inputs are valid, then asp will take the inputs and post it to the form action, and the user will be sign-in. If the inputs are not valid then asp will do a Response.Write("Invalid input!"), prompting users to check their inputs.

Now heres my question.
After ASP has confirmed that the inputs are valid, how do I get ASP to post the inputs to a form action?

Once I get this to work, I think it may now be possible to customize the whole email pages. I hope my situation is a little bit clearer now. I welcome any suggestions you can give. Thankx in advance.





 
Sidro,

There are only two ways to validate form entries:
1) Client side
2) Server side

On client side, you normally do validations such as checking if the entry is blank, numeric, within the permitted range of values, etc.

On server side, this is where you check for information found in your database. This is the case whenever you check if a password entered is correct.

ASP is a server side script, so you cannot use it for client side validation.

Hope this gives you a better understanding of what will and will not work for you.

Medic
 
Hello medic,

Thank you for reminding me about how to validate form entries. Although, I can assure you that, I still remember how to validate form entries.


"ASP is a server side script, so you cannot use it for client side validation. "

> On the contrary, ASP can be use to do validation such as entry blank,numeric,permitted range of values,ect.. That is, if one wants to design it that way. The only downside to this approach would be speed.

 
I'm not sure how you propose to your validation, I'll leave that alone.

So your form submits, it's validated, and now you want to populate a second form and have it submit to the mail page.

On your second page all you need to do is setup the populated form and, in the body tag, use the onLoad event to frmName.submit():
Code:
<%
'validation here
if valid then
   %>
   <html>
   <body onLoad=&quot;frmLogin.submit();&quot;>
   <form method=&quot;POST&quot; action=&quot;mailpage.asp&quot;>
   <input type=&quot;hidden&quot; name=&quot;username&quot; value=&quot;<%=Request.Form(&quot;username&quot;)%>&quot;>
   <input type=&quot;hidden&quot; name=&quot;password&quot; value=&quot;<%=Request.Form(&quot;password&quot;)&quot;>
   </form>
   </body>
   </html>
   <%
Else
   'do whatever if it wasn't valid login info
End If
%>
And there we have it, a form that will submit automatically to the mailpage if everything is valid.

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
hello Tarwn,

Unlike others, you weren't concern with my validation methods and all else. Instead, you went directly to my question and answered it. You are the man!

--> <body onLoad=&quot;frmLogin.submit();&quot;>
This is the code snippet I was looking for. With this snippet, I can finally work around ASP.net's posting restriction. Thank you sir!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top