Read all FORM fields into PayPal |
home page std.css |
We take the above (in the main article) simple scripts and combine them into a routine that reads all FORM elements and puts them into PayPal data. The abilities of each of the above simple scripts are maintained. Something new here is the ability to direct items into different variables of PayPal (including selects).
We start with the output of the PayPal button factory and make a few changes. Then the JS processes the FORM and adjusts the fields. Right-click on this page (and <view source>) to see what was done.
1a = 1st option field name area (50 chars). 1b = 1st option field data area (200 chars). 2a = 2nd option field name area (50 chars). 2b = 2nd option field data area (200 chars). 3i = item_number field data area (127 chars). .. (Anything else, description area - 127 chars.)
Here is an example of what you may put into the value of an option field of a select...
<option value="Item #A1234 s1=10 s2=8.50 @25.00">...</option>
Setting shipping is a little tricky, in that if you use it in any value field of a select, then you must use it in every value field, even if it is set to zero. Also, don't forget to include the hidden shipping and shipping2 fields in your FORM so they can be stuffed.
We are getting a little more sophisticated here by adding an extra argument to ReadForm so the text validation is only done upon FORM submission.
Contact me concerning this article at
paypalhelper@aol.com.
Mention "read all" in your note.
Individual help starting at $25.00 for simple JS solutions.