ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old June 25th, 2003, 07:24 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
not getting proper input from asp form

following is the simple asp code I am just trying to get input from user but not getting the value of the first fiels that "tname" can somebody help me out of this mess

<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
Dim tname, discription

tname = Request.Form("tname") ' this is the line but it is not getting the value of tname from the form

discription = Request.Form("S1")
Session("filename")=tname
Session("filedis")=discription
Response.Redirect("rah.asp")
Response.End
End If

%>

<html>
<head>
<title>upload</title>
<script Language="javascript">
function confirm_entry()
{
if (document.MyForm.tname.value="")
{
alert("Please enter the Name of the Update")
return (false);
}
return (true);
}
</script>

</head>
<body bgcolor="f1f1f1">

<form method="post" action="issupring.asp" name="MyForm" onSubmit="return confirm_entry(this.form);">
<p align="center">
<font face="Verdana" size="1"><b>
Update Name</b>:&nbsp;<input type="text" name="tname">

</font>

<p align="center"><font face="Verdana" size="1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Description</b>&nbsp; : <textarea rows="2" name="S1" cols="20"></textarea></font></p>

<p>&nbsp;</p>
<p align="center">
<font face="Verdana" size="1">
<input type="submit" name="submit" value="Submit">

</font>

</html>tname = Request.Form("tname") tname = Request.Form("tname") tname = Request.Form("tname")
__________________
Rahul

Small things lead to perfection and perfection is not a small thing.

Reply With Quote
  #2  
Old June 25th, 2003, 08:11 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Why

are you checking to see *how* your <form>...</form> is posted ?

Why do this:
if Request.ServerVariables("REQUEST_METHOD")="POST" then
Didn't *you* the programmer decided *how* you would post your <form>...</form> ?

If your *NOT* sure how the <form>...</form> was posted then simply use the Request() without using the .Form or .QueryString


Then, make some debugging. For example:

<%
Dim tname, discription

tname = Trim(Request.Form("tname") )
'FOR DEBUG ONLY
'Response.Write "-->" & tname & "<--<hr>"
'Response.End


'You can even make some validation!
If tname = "" Then
Response.Write "No value entered for tname!"
Response.End ' or use Response.Redirect
End If

. . . REST OF CODE...
. .
.
%>


Tell me if I'm wrong but what *I* think your doing is:

You have a page called *issupring.asp* that submits to *itself*
You then retrieve the values and put them into *Session* variables. Once this is done you make a redirect to *rah.asp*


If that is correct my question to you is why ?

Why not make your <form>...</form> action attribute go to the rah.asp ?

And at the *top*/*beginning* of the rah.asp page simply do:


----rah.asp
<%
Dim tname
Dim discription

tname = Trim(Request.Form("tname"))
discription = Trim(Request.Form("S1"))
'FOR DEBUG ONLY
'Response.Write "-->" & tname & "<--<hr>"
'Response.Write "-->" & discription & "<--<hr>"
'Response.End


'Validation if empty
If tname = "" Then
.....CODE...
End If


'Ok so now we know the variable *tname* holds something..
'Put the value into the session variable
Session("filename")=tname

'-------continue loading the rest of rah.asp-------------
%>


Hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old June 25th, 2003, 08:49 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Hello Vlince,

Thanx for the reply

You have understood the problem correctly, and I think that the suggesstion given by you will work.

Actually I am a bit new in asp coding, I will try your suggessions and reply you back

Thanx once again

Reply With Quote
  #4  
Old June 25th, 2003, 09:13 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Hello Vlince,

Sorry, to say that it will not Work because I am using Request.binary in rah.asp so I can not use Request.form in that page so I have to do this in issupring.asp only.
any new suggessions

Thanx
Rahul

Reply With Quote
  #5  
Old June 25th, 2003, 09:24 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
ok

so continue with your first approach, the one where you make a redirect to rah.asp

There is no errors in the code you've showed in your first post, although you claim that there is no value inside the variable tname right?

What does the Response.Write of the variable give you?


<%
Dim tname, discription

tname = Trim(Request.Form("tname") )
'FOR DEBUG ONLY
Response.Write "-->" & tname & "<--<hr>"
Response.End

...rest of code...
%>

What do you see between the --> and <-- on your browser?

Reply With Quote
  #6  
Old June 25th, 2003, 09:28 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
nothing blank for tname but it gives value of description
I dont know why it is not taking the value of tname I must have messed woith the HTML code somewhere but I m unable to figure it out see if you can help
thanx
Rahul

Reply With Quote
  #7  
Old June 25th, 2003, 09:43 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
try a simple example:

1) create an .asp page called page1.asp
2) create a <form>...</form> that as a method set to *POST* and an *action* attribute set to page1.asp
3) create one <textbox> called *tname*
4) create a <textarea> with the name *S1*
5) Add a <submit> button

NOTE: Lose the onSubmit attribute for testing purposes only.

Then copy the code you have and make a response.write of the variable tname and the description one.

See the results...

then, if it works, start adding your javascript again.

Reply With Quote
  #8  
Old June 25th, 2003, 09:51 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
ok pal
I will try this
thanx for the support

Reply With Quote
  #9  
Old June 26th, 2003, 11:31 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
It is still not working
if you want I will attach rah.asp also
please I need help I have to do it

Reply With Quote
  #10  
Old June 27th, 2003, 05:41 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
still waiting for the answer can anybody there who can help

Reply With Quote
  #11  
Old June 27th, 2003, 08:14 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Ok

I've copy/pasted the code from your *first* post and I tweaked it a bit. The changes I did are in bold.


Ok here, you can copy/paste this its tested and it works!
------------------------------------------------------------------------


<%@ Language=VBScript %>
<%Option Explicit%>
<%Response.Buffer = true%>

<%
If Request.Form("hidSubmit") = "1" Then

Dim tname
Dim discription

tname = Trim(Request.Form("tname"))
discription = Trim(Request.Form("S1"))

Session("filename") = tname
Session("filedis") = discription
'Response.Redirect("rah.asp")
'Response.End


'FOR DEBUG ONLY
'Response.Write "-->" & Session("filename") & "<--<hr>"
'Response.Write "-->" & Session("filedis") & "<--"
'Response.End

End If
%>

<html>
<head>
<title>upload</title>
<script Language="javascript">
function confirm_entry()
{
if (document.MyForm.tname.value == "")
{
alert("Please enter the Name of the Update")
return (false);
}
return (true);
}
</script>
</head>
<body bgcolor="f1f1f1">

<form method="post" action="test.asp" name="MyForm" onSubmit="return confirm_entry(this.form);">
<input type="hidden" name="hidSubmit" value="1">
<p align="center">
<font face="Verdana" size="1"><b>
Update Name</b>: <input type="text" name="tname">

</font>

<p align="center"><font face="Verdana" size="1"><b>
Description</b> : <textarea rows="2" name="S1" cols="20"></textarea></font></p>

<p> </p>
<p align="center">
<font face="Verdana" size="1">
<input type="submit" name="submit" value="Submit">

</font>

</body>
</html>



A couple of things:
First I've changed the action attribute of your <form>...</form> to test.asp and my page is named test.asp. So the idea is that the page submits to itself.

Second, I've added a <hidden> field so that when the user clicks the <submit> button I know(at the top of the page) if the page has been submitted or not.

I notice that your where doing/making a Response.End after your Response.Redirect "rah.asp". But it is *NOT* necessary because *NO CODE IS EXECUTED* after a Response.Redirect.
For now, in the example, I've commented the two lines
'Response.Redirect("rah.asp")
'Response.End


I've also added a FOR DEBUG ONLY section which makes a Response.Write of the two Session variables.


You also had an error inside your javascript function
you only had *one* equal sign but in fact you need *two* equal sign otherwise the <form>...</form> would *still* submit even if the <textbox> is equal to ""(empty string)

NOTE: You might also want to check/search for a javascript trim() function cause the user could simply enter a space inside your textbox and bypass the javascript validation. Try it...

Then inside the <form>....</form> I've added a <hidden> field that will use when the form is submitted.

At last, I've added a </body> which was missing from your first post.


Hope this helps!
Sincerely

Vlince

Reply With Quote
  #12  
Old June 27th, 2003, 09:30 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Thanx Vlince,
I will try it today and tell you the outcome.

Vlince, it is working fine when I am just accessing issupring.asp means it is showing the all the values, but it is not taking the values in rah.asp, I will try the given steps if it will not work I will attach the rah.asp also
thanx once again

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > not getting proper input from asp form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |