Solved

Passing a form field value ...

Posted on 1998-06-28
5
188 Views
Last Modified: 2010-04-09
Hi...
  I've got the following very simple HTML for when I click a 'Click Here' button (I have a form action statement at the beginning of my HTML with the script that it invokes):

<INPUT TYPE="hidden" NAME="CUSTID"
VALUE="3205"><INPUT TYPE="hidden" NAME="LOGIN"
VALUE="jsmith"><INPUT TYPE="hidden" NAME="AMOUNT"
VALUE="50.00"><INPUT TYPE="hidden" NAME="DESCRIPTION"
VALUE="Click Here">

..What I'd LIKE to have ideally is to just have a little form right above this 'Click Here' button ,where the user could simply enter any dollar amount, then this amount would be passed to the 'NAME="AMOUNT" VALUE="50.00"' field. So that the number they enter would be substituted for the "50.00"...Can this be done?

Thanks
  Shawn Halfpenny
  drumme59@sprint.ca
0
Comment
Question by:aztec
  • 3
  • 2
5 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 50 total points
ID: 1844429
1. give the form a name:

<form name="anExample" action="  ">

2. make the textfield
<input type="text" name="fill" onChange="ChangeHiddenField(document.anExample.fill.value)"

3. include the javascript that changes the hidden field

<script>
function ChangeHiddenField(string) {
 document.anExample.AMOUNT.value = string;
}
</script>

- You can include some verifying in the function, to see if it is really a number

- But why don't you just use the text field ? Why a hidden field ?

0
 

Author Comment

by:aztec
ID: 1844430
ummm Sybe...you are confusing me. OK, I will explain FULLY my situation: I am implementing a method of accepting on-line credit card payment known as "magic button". Usually, the user simply clicks the "Magic Button", and the data hard-coded in the HTML (price, etc.) gets sent to the Magic Button server for processing. This is all fine. However we do not have a set price that we can simply hard-code into the HTML and leave like that...we charge various prices. That's why would we would like to have a little form field where we can simply type in our desired price and it gets carried on to the Magic Button server for processing (...instead we would have to hard-code each different price into the HTML each time...too time consuming)
  Consider too, I know nothing about CGI programming and Java! I am merely using the HTML code that the Magic Button people said to simply cut and paste and insert in my own web page...changing only the desired price and my ID #.
  Here is the HTML that I inserted as per their sample on their website:

<FORM action="https://www.authorize.net/scripts/authnet25/WebLink.asp" method="POST">


<P><CENTER>If you agree with the above terms and conditions, click
the Magic Button! <INPUT TYPE="hidden" NAME="CUSTID"
VALUE="3205"><INPUT TYPE="hidden" NAME="LOGIN"
VALUE="mgordon"><INPUT TYPE="hidden" NAME="AMOUNT"
VALUE="50.00"><INPUT TYPE="hidden" NAME="DESCRIPTION"
VALUE="Magic Button"></CENTER></P>

<P><CENTER><INPUT TYPE="submit" NAME="jack russell"
VALUE="Magic Button">
<HR>

.I simply want to be able to input a price into a field, and have that price be used in place of the VALUE="50.00", that you see up above. I hope this makes things clearer!

Cheers
   Shawn Halfpenny
   drumme59@sprint.ca

P.S: Please see their example at http://www.myfreeoffice.com/takevisa/magic.html
0
 

Author Comment

by:aztec
ID: 1844431
Sybe...are you there?

Shawn
0
 
LVL 28

Expert Comment

by:sybe
ID: 1844432
yeah i am here, but i am going to sleep, since I am in Europe. I will have a look at it tomorrow.
0
 
LVL 28

Expert Comment

by:sybe
ID: 1844433
I see what you want.

The thing is that the CGI does not care if the formfield is text, hidden or whatever, what only counts is the name and the value.

So if you have a form, and you need a pass a value for AMOUNT, then you can just create a text field with the name AMOUNT and in your case not use a hidden field with the name AMOUNT.

You can make a text field with the name AMOUNT like this:

<input type="text" name="AMOUNT">

IS this closer to what you need ?
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can i create a customized Login page based on Wordpress ? 8 36
Link a VBS to an HTA 6 36
ASP server side get value 15 22
alert(innerHTML); 8 15
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question