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 effect without using 'Form' 2

Status
Not open for further replies.

LittleSmudge

Programmer
Mar 18, 2002
2,848
GB
I'm a Db developer just getting into web front ends - so bear with me.

I have a series of .asp pages and I'm using
<FORM Method="Post">
to transfer data from one page to another

The following works okay
Code:
   <TD ALIGN=CENTER BGCOLOR="#800000">
     <FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=2>View Current Jobs
     </FONT>
   </TD>
   <TD>
      <FORM NAME="request" Action="ViewJobs.asp" method="POST"> 
      <INPUT TYPE="hidden" NAME="JobType" VALUE="Current">
      <INPUT TYPE="hidden" NAME="ClientId" VALUE=<% Response.Write(ClientRef) %> >
      <INPUT TYPE="hidden" NAME="UserId" VALUE=<% Response.Write(UserId) %> >
      <INPUT TYPE="hidden" NAME="Authorise" VALUE=<% Response.Write(Authorise) %> >
      <INPUT TYPE="submit" value="Go"> 
      </FORM>
   </TD>

However, it displays as text followed by a button.
I'd like to make the text active, like using
<A HREF= .. .. etc
and get rid of the button.

But I can't seem to get the Method="Post" part to transfer the data to the next form.

Is this an HTML question or should I be on the ASP board ?




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 

So where do the
<INPUT TYPE="hidden" .. ..
parts go ?


I've tried
Code:
<TD ALIGN=CENTER BGCOLOR="#800000">
   <A STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=2 HREF="ViewJobs.asp" onclick="Submit()" method="POST" >View Old Jobs
   <INPUT TYPE="hidden" NAME="JobType" VALUE="Old">
   <INPUT TYPE="hidden" NAME="ClientId" VALUE=<% Response.Write(ClientRef) %> >
   <INPUT TYPE="hidden" NAME="UserId" VALUE=<% Response.Write(UserId) %> >
   <INPUT TYPE="hidden" NAME="Authorise" VALUE=<% Response.Write(Authorise) %> >
   </A>
</TD>

but that opens the correct from but it's not POSTing the data. It is still performing a GET.

I note that in your post you put HREF = "#"
If I use that 'literally' where do I put the actual name of the file that I need it to go to ?




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
oh i see
you have to use a form to post data
Code:
      <FORM NAME="request" Action="ViewJobs.asp" method="POST"> 
      <INPUT TYPE="hidden" NAME="JobType" VALUE="Current">
      <INPUT TYPE="hidden" NAME="ClientId" VALUE=<% Response.Write(ClientRef) %> >
      <INPUT TYPE="hidden" NAME="UserId" VALUE=<% Response.Write(UserId) %> >
      <INPUT TYPE="hidden" NAME="Authorise" VALUE=<% Response.Write(Authorise) %> >
<a href="#" onclick="Submit()">submit</a>
      </FORM>

I am confused though. What else is on the page that you are trying to send to the next page?
Where does ClientRef etc come from?

Can you post the whole page for me? and maybe the page after as well?
 
Okay Dave

Form starts with
Code:
<%UserId = Request.Form("UserId")
If UserId = "" Then
    UEmail = Request.Form("UEmail")
    If UEmail = "" then
        Response.Redirect "GetEAddress.asp"
    End If
End If
%>

<!--#include virtual="Support/head.shtm" -->
<TITLE>Main Jobs Menu</TITLE>
</HEAD>
<!--#include virtual="Support/Body.shtm" -->

<CENTER>
<H1>Service Support Section</H1>
<H2>Jobs Listing Main Menu</H2>
<HR>
<%
Dim myDll
Dim myArray
Dim ClientRef 
Dim UName
Dim UEmail
Dim UPassword
Dim Authorise

then comes a large chunk of VBScript that looks up the values of ClientRef, UName,UEmail, etc .. based on the values in UserId OR UEmail that came in from the preceeding form


Then HTML Creates a four row table of options
( That works fine. )
Currently I use the HTML as per the original post to put text in the first <TD> and the FORM in the second <TD>

However, I'd like the user to just be able to click on the text ( Only one column in the table. )

I need to pass the Values in JobType, UserId, ClientRef, etc to the next form as they control which records are extracted from the database and displayed on that form.


Then 'next' form works fine if I use the two column approach - I'd just like to get away from having the additional button when I feel I should be able to let the user just click on the text itself.




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
oh i get you

ok

<a href ="ViewJobs.asp?JobType="<%=JobType%>"&UserId="<%=UserId%>"&"ClientRef="<%=ClientRef%>">Job Details</a>

On the next page use request.querystring("JobType") to get the JobType etc.

That will do you, no forms needed :)
 
sorry
Code:
<a href ="ViewJobs.asp?JobType="<%=JobType%>"&UserId="<%=UserId%>"&ClientRef="<%=ClientRef%>">Job Details</a>
 
How about going about it a little differently? Get rid of the link and have only submit button. You're back on one thing and it works cross browser (no problem with the javascript turned off. If you don't like the way the button looks...
Code:
<style type="text/css">
.button {
  border: none;
  background: transparent;
  font: normal 1em "Arial Narrow", sans-serif;
  color: white;
  text-decoration: underline;
}
</style>

<input class="button" type="submit" value="View Old Jobs" />
That should do the trick.
 
That fixes one problem but creates another.

By putting the ClientId into the Address string it would allow any user to change the Client records they are viewing.

Thus someone from one client could see all of the records from any of the other clients. NOT desirable.

Is there no way of changing the Look / Colour / Size etc of the <FORM> button ?




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Thanks folks. That has got me to where I need to be ( for today ).

From "How do I get PWS running" earlier this week

to "Using and customising Cascading Style Sheets" today.

What a week.

A Star to you Dave for sticking with me and one for Vragabond for coming up with the final solution.

Thanks again.

G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
By putting the ClientId into the Address string it would allow any user to change the Client records they are viewing.
Be aware that anybody can do a View Source on your page and write a form that will request another client's records. You need to be doing some additional checking within your program, for example ensuring that the given UserID is allowed to see the given CLientID.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thanks for that Chris - another re-think due I believe.


G.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top