[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Passing a form field value ...

Posted on 1998-06-28
5
Medium Priority
?
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

656 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