[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Passing a form field value ...

Posted on 1998-06-28
5
Medium Priority
?
199 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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

872 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