473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Auto Submitting a form

1
Having a little problem with a project my boss gave me. We have a web based hosting site that we have multiple databases that the users can connect to. Right now we have it set up that they can choose the database they want to login to but he wants it to login to the only database the user is allowed to see.

I have a login script that I am using on another project that works great by using redirect. The problem I have with the doing the same thing on this is I need to post a form on the server so it connects to the right database and loads the software correctly.

Example of good page:

User enters username and password. If both are correct then redirect to the next page. If not, send them to a page saying that the login was incorrect.

Example of issue page:

User enters username and password. It checks to see that both are correct and populates what database they need. Once this is done I create my form with hidden fields and then...bla. I need to simulate the clicking of the submit button so the information gets processed with no user clicking.

Here is the code I need to get auto submitted:
Expand|Select|Wrap|Line Numbers
  1. <Form Action="@ITEM_PROTOCOL@://@ITEM_SERVER@/" METHOD=POST>        
  2. <INPUT type="Hidden" NAME="USER" VALUE=strUserName>
  3. <INPUT TYPE="hidden" NAME="Password" Value=rsCheckUser("pass")>
  4. <INPUT TYPE="Hidden" NAME="Database" Value=rsCheckUser("database")>
  5. <INPUT TYPE="hidden" NAME="STATION" VALUE="View">
  6. <INPUT  NAME="CONNECTION" TYPE="hidden" VALUE=@ITEM_CONNECTION@ >
  7. <INPUT  NAME="FRAME"      TYPE="hidden"  VALUE="ALL"> 
  8. <INPUT NAME="HITS" TYPE="HIDDEN" VALUE="ON">    
  9.  
  10.  
The page that this code is on is all ASP and just does the checking and the goes to the regular pages. I know I can put a confirm button on the page but I want to have nothing on this page the user can see.
Any Ideas?
Jun 29 '07 #1
2 2119
jhardman
3,406 Expert 2GB
There are two possibilities. One is a javascript approach which submits the form as soon as the document loads. I'm not an expert on javascript, but syntax is something like:
[html]onload="document.all.myFormName.submit()"[/html] notice your form needs to be named for this to work. Or it might need an ID. Like I said, I'm not an expert.

The second option is to pass a whole bunch of querystring data in the URL when you redirect.
Expand|Select|Wrap|Line Numbers
  1. page = "nextPage.asp?USER=" & strUserName
  2. page = page & "Password=" & rsCheckUser("pass")
  3. response.redirect page
If you previously only accepted form data with code like
Expand|Select|Wrap|Line Numbers
  1. request.form("USER")
this will need to be changed to
Expand|Select|Wrap|Line Numbers
  1. request.querystring("USER")
OR
Expand|Select|Wrap|Line Numbers
  1. request("USER")
notice that either of these work. Now that I think about it, you could also pass this data as cookies or as session-level variables, but querystring data takes the least amount of re-writing.

Let me know if this helps or if you would like further clarification.

Jared
Jun 29 '07 #2
danp129
323 Expert 256MB
I think something other than querystring would be best if users might be going through a proxy. The URI is almost always logged by default whereas POST isn't. Just my preference though.
Jun 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: James | last post by:
I have a form with a drop down list.. When the user selects the value from the list I want it to refresh automatically, as if the user has pressed submit... I have named the form 'test' and...
2
by: Greg T | last post by:
Hi, I have a rather long form that I don't want people submitting unless they are absolutely sure they are ready. I figured the easiest way to prevent an accidental form submission by way of...
5
by: Don | last post by:
I have a need to submit a form, but don't need the user to click on a button. How do I do this? Is there some way, using JavaScript, to setup a <form> tag to do this? Thanks, Don ----==...
2
by: Rick Strahl [MVP] | last post by:
Run into an interesting problem today with a client of mine: They have an ASP.Net form that they want to drive through a client side HTTP interface. I know a Web Service would be a better way to...
1
by: Michelle | last post by:
Hi All, I have an ASP.NET application with a session timeout of 20 minutes - for security reasons. I have a web form in this application that I need to Auto Save every 15 minutes (in case the...
5
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input...
1
by: Badass Scotsman | last post by:
Hello, I have an application which should never allow the back button to be pushed without refreshing the previous page. For example: Step 1: User fills in form.html and presses submit ...
18
by: NavinM | last post by:
I have a couple of forms that are misbehaving in FireFox, but work fine in IE. when i do submit( with submit button) a javascript function validates all of the fields entered, and stops the...
10
by: laredotornado | last post by:
Hi, I'm using php 5. Does anyone have any code or a function that auto submits a form that contains a single INPUT, of type = file? Thanks, - Dave
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.