Passing Values To TextBox from a Sub 
Author Message
 Passing Values To TextBox from a Sub

Hi,

Pls show me the snipet or refer me to url how to solve this:

I have these controls in a page:

  CheckBox named cboxOK
  TextBox named tboxQty
  TextBox named tboxUnitPrice
  TextBox named tboxAmount

When the user click cboxOK, it's OnClick event fires that multiplies
tboxQty by tboxUnitPrice and supposedly return the value to tboxAmount
but this doesn't work.

Could anybody show me how to do this?

Thanks in advance.

Arnold



Tue, 31 Aug 2004 02:07:07 GMT  
 Passing Values To TextBox from a Sub
what code are you using at the moment?

Atrax - MVP [Microsoft Most Valued Professional]

http://www.infinitemonkeys.ws/

Host with me for $100 a year!
http://www.atrax.ws/hosting/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 30 Aug 2004 11:03:43 GMT  
 Passing Values To TextBox from a Sub
Hi,

I am using ASP.

Thanks

Arnold

Quote:

> what code are you using at the moment?

> Atrax - MVP [Microsoft Most Valued Professional]

> http://www.infinitemonkeys.ws/

> Host with me for $100 a year!
> http://www.atrax.ws/hosting/

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Tue, 31 Aug 2004 06:00:08 GMT  
 Passing Values To TextBox from a Sub
You might want to check your system clock and time zone. You appear to be close to a day ahead of the rest of us... :)

: Hi,
:
: I am using ASP.
:
: Thanks
:
: Arnold
:
:
: > what code are you using at the moment?
: >
: > Atrax - MVP [Microsoft Most Valued Professional]
: >
: > http://www.infinitemonkeys.ws/
: >
: > Host with me for $100 a year!
: > http://www.atrax.ws/hosting/
: >
: > *** Sent via Developersdex http://www.developersdex.com ***
: > Don't just participate in USENET...get rewarded for it!
:



Mon, 30 Aug 2004 21:52:25 GMT  
 Passing Values To TextBox from a Sub
Alex,

Oh really, well I should have wrote VBScript instead of PSA right?  You know its wrogn dont you?  So why bother
answering?  Most people who starts using vbsript comes here and people who answer them are not obligated to do so! RGITH!

Quote:

> You might want to check your system clock and time zone. You appear to be close to a day ahead of the rest of us... :)


> : Hi,
> :
> : I am using ASP.
> :
> : Thanks
> :
> : Arnold
> :

> :
> : > what code are you using at the moment?
> : >
> : > Atrax - MVP [Microsoft Most Valued Professional]
> : >
> : > http://www.infinitemonkeys.ws/
> : >
> : > Host with me for $100 a year!
> : > http://www.atrax.ws/hosting/
> : >
> : > *** Sent via Developersdex http://www.developersdex.com ***
> : > Don't just participate in USENET...get rewarded for it!
> :



Wed, 01 Sep 2004 01:30:57 GMT  
 Passing Values To TextBox from a Sub
when I asked what code you were using, i didn't mean what langauge
(although technically ASP is not even a language)

Atrax - MVP [Microsoft Most Valued Professional]

http://www.infinitemonkeys.ws/

Host with me for $100 a year!
http://www.atrax.ws/hosting/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 31 Aug 2004 10:19:31 GMT  
 Passing Values To TextBox from a Sub
ummm...  ASP is not code, it's a server side technology (an ISAPI DLL to be precise).

Atrax was hinting (a little too subtle I guess) that you post the actual VBScript code that you are using.  That gives everyone something to start with rather than having to code up an example that may not look anything like what you have...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:

> Hi,

> I am using ASP.

> Thanks

> Arnold


> > what code are you using at the moment?

> > Atrax - MVP [Microsoft Most Valued Professional]

> > http://www.infinitemonkeys.ws/

> > Host with me for $100 a year!
> > http://www.atrax.ws/hosting/

> > *** Sent via Developersdex http://www.developersdex.com ***
> > Don't just participate in USENET...get rewarded for it!



Tue, 31 Aug 2004 10:22:51 GMT  
 Passing Values To TextBox from a Sub
Hi Mike,

Here's the code, pls help:

<%
  if request("txtCol11") = "ON" then
    dCol21 = request.form("txtCol21")
    dCol51 = request.form("txtCol51")
    dCol61 =  dCol21 * dCol51
    wasChecked = true
  end if
%>
<html>

<head>
<title>New Page 1</title>
</head>

<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%">Test on click event</td>
  </tr>
  <tr>
    <td width="100%">&nbsp;
    </td>
  </tr>
  <tr>
    <td width="100%">
<!-- this action posts to itself -->
      <form method="POST" action="tester.asp">
      <table border="0" width="100%" cellpadding="0" cellspacing="5">
        <tr>
          <td width="2%" valign="top" align="center">
          <input type="checkbox" name="txtCol11" value="ON" <% if wasChecked then %> checked <% end if%> ></td>
          <td width="1%" valign="top">
          <input type="text" name="txtCol21" size="4" value="<%= dCol21 %>"></td>
          <td width="11%" valign="top">
          <input type="text" name="txtCol51" size="13" value="<%= dCol51 %>"></td>
          <td width="53%" valign="top">
          <input type="text" name="txtCol61" size="14" value="<%= dCol61 %>"></td>
        </tr>
      </table>
      <p>
      <input type="submit" value="Submit" name="B1">
      <input type="reset" value="Reset" name="B2">
      </p>
      </form>
    </td>
  </tr>
  <tr>
    <td width="100%"></td>
  </tr>
</table>

</body>

</html>

Thanks,

Arnold

Quote:

> ummm...  ASP is not code, it's a server side technology (an ISAPI DLL to be precise).

> Atrax was hinting (a little too subtle I guess) that you post the actual VBScript code that you are using.  That gives everyone something to start with rather than having to code up an example that may not look anything like what you have...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US
> --

> > Hi,

> > I am using ASP.

> > Thanks

> > Arnold


> > > what code are you using at the moment?

> > > Atrax - MVP [Microsoft Most Valued Professional]

> > > http://www.infinitemonkeys.ws/

> > > Host with me for $100 a year!
> > > http://www.atrax.ws/hosting/

> > > *** Sent via Developersdex http://www.developersdex.com ***
> > > Don't just participate in USENET...get rewarded for it!



Wed, 01 Sep 2004 05:59:06 GMT  
 Passing Values To TextBox from a Sub
Alex just gave you a <friendly> tip. If your posts is ahead of current time, you are "messing" up the date sort in a lot of
news readers, and a lot of people don't like that at all.

--
torgeir

Quote:

> Alex,

> Oh really, well I should have wrote VBScript instead of PSA right?  You know its wrogn dont you?  So why bother
> answering?  Most people who starts using vbsript comes here and people who answer them are not obligated to do so! RGITH!


> > You might want to check your system clock and time zone. You appear to be close to a day ahead of the rest of us... :)



Tue, 31 Aug 2004 14:36:51 GMT  
 Passing Values To TextBox from a Sub
???
Just thought I would let you know.

: Alex,
:
: Oh really, well I should have wrote VBScript instead of PSA right?  You know its wrogn dont you?  So why bother
: answering?  Most people who starts using vbsript comes here and people who answer them are not obligated to do so! RGITH!
:
:
:

:
: > You might want to check your system clock and time zone. You appear to be close to a day ahead of the rest of us... :)
: >

: > : Hi,
: > :
: > : I am using ASP.
: > :
: > : Thanks
: > :
: > : Arnold
: > :

: > :
: > : > what code are you using at the moment?
: > : >
: > : > Atrax - MVP [Microsoft Most Valued Professional]
: > : >
: > : > http://www.infinitemonkeys.ws/
: > : >
: > : > Host with me for $100 a year!
: > : > http://www.atrax.ws/hosting/
: > : >
: > : > *** Sent via Developersdex http://www.developersdex.com ***
: > : > Don't just participate in USENET...get rewarded for it!
: > :
:



Tue, 31 Aug 2004 22:23:56 GMT  
 Passing Values To TextBox from a Sub
If this guy is on Prozac, he needs to stop taking it. If he's not, he needs to start taking it.

He also needs to learn how to write, but that's another story.

: Alex just gave you a <friendly> tip. If your posts is ahead of current time, you are "messing" up the date sort in a lot of
: news readers, and a lot of people don't like that at all.
:
: --
: torgeir
:
:
: > Alex,
: >
: > Oh really, well I should have wrote VBScript instead of PSA right?  You know its wrogn dont you?  So why bother
: > answering?  Most people who starts using vbsript comes here and people who answer them are not obligated to do so! RGITH!
: >

: >
: > > You might want to check your system clock and time zone. You appear to be close to a day ahead of the rest of us... :)
: > >
:



Wed, 01 Sep 2004 02:02:46 GMT  
 Passing Values To TextBox from a Sub
The code you posted does work as written as long as you never submit without putting numeric values in the 1st 2 test boxes.  If you leave either of them blank or put a non-numeric value in either, then it crashes server side when it blindly tries 2 multiply with a non0-numeric value...

But back to your original post...

It isn't the checking of the checkbox that makes anything happen, it's the submission of the form with it checked.  If the only purpose of the checkbox is to check for a submission, then just use

<%
If Request.Form.Count > 0 Then
    ...

%>

You don't need the checkbox at all...  And if a page is designed to post back to itself, just leave the form's action="" or omit altogether.

And you really need to check for and handle non-numeric input.

<%
  if request.Form.Count > 0 then
    dCol21 = request.form("txtCol21")
    dCol51 = request.form("txtCol51")
    if not isnumeric(dCol21) then dCol21 =0
    if not isnumeric(dCol51) then dCol51 =0
    dCol61 =  dCol21 * dCol51
  end if
%>
<html>

<head>
<title>New Page 1</title>
</head>

<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%">Test on click event</td>
  </tr>
  <tr>
    <td width="100%">&nbsp;
    </td>
  </tr>
  <tr>
    <td width="100%">
<!-- this action posts to itself -->
      <form method="POST" action="">
      <table border="0" width="100%" cellpadding="0" cellspacing="5">
        <tr>
          <td width="1%" valign="top">
          <input type="text" name="txtCol21" size="4" value="<%= dCol21 %>"></td>
          <td width="11%" valign="top">
          <input type="text" name="txtCol51" size="13" value="<%= dCol51 %>"></td>
          <td width="53%" valign="top">
          <input type="text" name="txtCol61" size="14" value="<%= dCol61 %>"></td>
        </tr>
      </table>
      <p>
      <input type="submit" value="Submit" name="B1">
      <input type="reset" value="Reset" name="B2">
      </p>
      </form>
    </td>
  </tr>
  <tr>
    <td width="100%"></td>
  </tr>
</table>

</body>

</html>

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:

> Hi Mike,

> Here's the code, pls help:

> <%
>   if request("txtCol11") = "ON" then
>     dCol21 = request.form("txtCol21")
>     dCol51 = request.form("txtCol51")
>     dCol61 =  dCol21 * dCol51
>     wasChecked = true
>   end if
> %>
> <html>

> <head>
> <title>New Page 1</title>
> </head>

> <body>
> <table border="0" width="100%" cellspacing="0" cellpadding="0">
>   <tr>
>     <td width="100%">Test on click event</td>
>   </tr>
>   <tr>
>     <td width="100%">&nbsp;
>     </td>
>   </tr>
>   <tr>
>     <td width="100%">
> <!-- this action posts to itself -->
>       <form method="POST" action="tester.asp">
>       <table border="0" width="100%" cellpadding="0" cellspacing="5">
>         <tr>
>           <td width="2%" valign="top" align="center">
>           <input type="checkbox" name="txtCol11" value="ON" <% if wasChecked then %> checked <% end if%> ></td>
>           <td width="1%" valign="top">
>           <input type="text" name="txtCol21" size="4" value="<%= dCol21 %>"></td>
>           <td width="11%" valign="top">
>           <input type="text" name="txtCol51" size="13" value="<%= dCol51 %>"></td>
>           <td width="53%" valign="top">
>           <input type="text" name="txtCol61" size="14" value="<%= dCol61 %>"></td>
>         </tr>
>       </table>
>       <p>
>       <input type="submit" value="Submit" name="B1">
>       <input type="reset" value="Reset" name="B2">
>       </p>
>       </form>
>     </td>
>   </tr>
>   <tr>
>     <td width="100%"></td>
>   </tr>
> </table>

> </body>

> </html>

> Thanks,

> Arnold


> > ummm...  ASP is not code, it's a server side technology (an ISAPI DLL to be precise).

> > Atrax was hinting (a little too subtle I guess) that you post the actual VBScript code that you are using.  That gives everyone something to start with rather than having to code up an example that may not look anything like what you have...

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > Seattle WA US
> > --

> > > Hi,

> > > I am using ASP.

> > > Thanks

> > > Arnold


> > > > what code are you using at the moment?

> > > > Atrax - MVP [Microsoft Most Valued Professional]

> > > > http://www.infinitemonkeys.ws/

> > > > Host with me for $100 a year!
> > > > http://www.atrax.ws/hosting/

> > > > *** Sent via Developersdex http://www.developersdex.com ***
> > > > Don't just participate in USENET...get rewarded for it!



Wed, 01 Sep 2004 06:51:59 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Need syntax for passing a TextBox array to a Sub

2. Passing Textboxes to a sub byref

3. Dmitry Svetlanov Passing a value to a textbox on another page

4. Passing a value to a textbox on another page

5. Pass VBScript Variable to HTML Textbox via Value Property

6. Passing Value from Module Function to Form sub problem

7. Passing a value from a sub-report

8. Pass Sub-Report value to Main

9. Passing values from the sub report, onto the main report

10. Newbie Post: Passing Values back to Sub Main

11. Sub(V1): passed by value or by reference?

12. Passing values to a sub or function using ONCLICK

 

 
Powered by phpBB® Forum Software