Paypal HTML Buttons - Upper limit to payments? - html

I'm having a HTML Paypal Button doing weird things.
It's on a site for Art buyers, and so the range of prices is pretty wild. There are 500$ artpieces to 4000$ art pieces.
When I try to buy the 500$ art piece, everything goes through no problem. But when I try to buy one at 2000$, I get a generic error message.
Sorry, we can’t complete your purchase at this time
Please return to the merchant and choose another way to pay.
Now I know it's not a failure of my form. It's the same form that is loaded every time; there's just the amount_1, item_name_1 and item_number_1 fields that change.
So it makes me think it's something with the price. Is there an upper limit to transactions in Sandbox mode? or is there an upper limit for Paypal HTML Buttons? I searched, and couldn't seem to find a straight answer to that.
EDIT: As asked by mplungjan, here is a basic try of the code. Only things that vary in both forms are price and name.
https://jsfiddle.net/fredy31/mrfn8e3b/5/
<input type="hidden" name="item_name_1" value="3000$ Product">
<input type="hidden" name="item_number_1" value="3000-product">
<input type="hidden" name="amount_1" value="3000">
And I've done a bit of research. Tried to find a response to this, but couldn't find a straight answer. What I've found is this: https://www.paypal-community.com/t5/About-Payments-Archive/What-is-the-transaction-amount-limit/td-p/616278 but it says the limit is 10k, and I'm still far from that.

Related

Limiting HTML Text bar to Only one Entry of Specific Characters

I currently have the code:
<td><input name="miles" type="number"
min="0" max="900" size="5" onkeyup="this.value=this.value.replace(/[^0-9.]+/g,'')"/></td>
This(onkeyup="this.value=this.value.replace(/[^0-9.]+/g,'')) limits the user to only entering digits and periods. What I want to do, however, is make it so that the user can only enter one period, and after that, every other period will be deleted. Is this possible? Thank you for taking the time to read this post, and have a wonderful day!
To accept only one period for input, you have to make it clear, that the period should repeat once only.
So this one may work in your case:
^-?[0-9]\d*(\.\d+)?$
NOTE: You can check the details of every regex here.

How to tell Chrome form does not contain credit card fields?

Chrome is being overzealous and thinks my HTML form contains credit card information and thus proposes to fill it in with credit card information.
Are there any attributes that I can use to tell Chrome that there is no credit card information to be filled in, in this form?
The field names it is trying fill in credit card information in are:
reg_id (it puts in a CC number here)
emergency_first_name (it puts in first name here)
emergency_last_name (it puts in last name here)
I don't want to have to disable autocomplete if I don't have to.
The frustrating thing here is the Chrome 'knows better' attitude, where it ignores any value to autocomplete, including off:
<input autocomplete="off" value="" size="10" maxlength="10" id="id_reg_id" name="reg_id" type="text">
Edit: updated following answers.
try
input type="custom"
or use textarea with a single row and resize off
Your browser shouldn't remember your credit card number by default -- I can only assume that you entered into a field that had a 'generic' autocomplete value on it. You can always force your browser to forget this information by simply hitting Delete when selecting it (with the arrow keys) in the dropdown of pre-fill options.
As for preventing it appearing in certain fields, it depends on what information you want each field to hold, but there's a wide array of autocomplete values that you can use. You can use number for IDs, and the other two fields you mentioned actually come with specialised autocomplete values, given-name and family-name:
<input name="reg_id" autocomplete="number" />
<input name="emergency_first_name" autocomplete="given-name" />
<input name="emergency_last_name" autocomplete="family-name" />
If number just won't cut it, you can also make use of a JavaScript regular expression to further restrict input:
const regex = new RegExp("^[a-zA-Z]+$");
const form = document.getElementsByTagName('form')[0];
const reg_id = document.getElementsByTagName('input')[0];
form.addEventListener('click', function(e) {
e.preventDefault();
if (regex.test(reg_id)) {
this.submit();
}
});
<form>
<input name="reg_id" autocomplete="number" />
<input name="emergency_first_name" autocomplete="given-name" />
<input name="emergency_last_name" autocomplete="family-name" />
</form>
I have been banging my head against the desk for a while because of this. We have forms to enter Instruments test data, and a field called "Test Card Number", as well as "Kit (Exp. Date)". Guess what Chrome thinks these fields are for?
Needless to say, I'm pretty sure the users would be VERY upset to see chrome us trying to pull their CC information when they're inputing clinical research data.
Even autocomplete="new-password" and autocomplete="nope" are failing to do any good, here.
I tried to load the field with no label and add it dynamically in javascript. No dice. Used html entities instead of characters. Nope.
Well, after a few hours of scouring the web with no solution in sight, I figured one out: insert a few random - within each word of the offending labels. (For me, with Test Card Number, it had to be in BOTH Card and Number. Test was fine left alone).
One could easily write a javascript extension/utility function to split the html of an offending label and slap that invisible span down the middle (and one to remove it in case of needing to use the label value).
Something like this (using jQuery and old js standards because we support old browsers, with no verifications if label is missing or empty, so adapt accordingly. In fact, I'm sure a regex or some other fancy stuff could be used, but I don't have the time to fiddle around with it atm):
jQuery.fn.breakAutofill = function () {
var $lbl = $("label[for='" + this[0].id + "']"),
finalText = $lbl.html().split(" "),
foilSpan = "<span style='display:none;'>-</span>";
for (var idx in finalText) {
var textVal = finalText[idx],
midPos = Math.floor(textVal.length / 2);
finalText[idx] = textVal.substr(0, midPos) + foilSpan + textVal.substr(midPos);
}
$lbl.html(finalText.join(" "));
}
Which you can then call on document ready :
$("your_input_selector").breakAutofill();
I hope that helps someone.

HTML link that appends a query string to the current URL

I have a simple form like this:
<form>
<input name="search">
<button type="submit">Search...</button>
Price: Low |
High
</form>
Note that input with the name of search allows to search for a keyword, while <a> links work as filters. When you submit the form, the URL would be e.g. localhost/products?search=smartphone. With my server-side script, this would yield a page with all products that contain a word smartphone in their name.
Now say I am at localhost?search=smartphone. If I click on Low, it would yield
http://localhost/products?filter=price&direction=asc
-> filter all products with price asc
However, what I am really intending to get is
http://localhost/products?search=smartphone&filter=price&direction=asc
-> search for 'smartphone', and filter only those results by price asc
How can I get to combine search and filter (with its asc or desc direction)? On a side note, is this efficient in terms of searching/filtering? Should I change <a> to <input>? I have little experience with searching mechanisms, so any suggestion would be appreciated!
use
onclick="form.submit();"
<form id="my_form">
<input name="search">
Price: Low |
High

HTML for topic Tour and Travel

Robert has created a user-defined function to ensure that the form fields are not left blank while
submitting the form. This is a time-consuming task. Help Robert to identify the form attribute that
he can use to ensure that the form fields are not left blank
Since Robert is working in HTML5, Robert can use the required attribute(for input fields) instead of writing separate user-defined function for blank fields.
Usage of the same
Username: <input type="text" name="usrname" required>
I hope this is helpful to Robert!!
There are also a variety of third party plugins to ensure the same. Robert should consider those options too!!

HTML form: how to submit a value without showing it in the form?

I have an HTML form that sends a food dish. For example,
placeorder.com/order.php?id=STEAK
I want to add another value and send
placeorder.com/order.php?category=MEAT&id=STEAK
But, I don't want the user to have to select meat anywhere, since this has been already decided.
I tried to tinker with the form target and include it from there, but it didn't work.
Is there some "hidden text box" to write the category to so that it gets posted, or is there another way to do it?
Thanks in advance!
First, I just thought I'd mention that it's funny how the questions is phrased since you pretty much answered your own question:
Is there some "hidden text box"
Anyway, yes:
You can use type='hidden'
I assume that you are already using a GET form so I will just include the input part:
<input name='category' type='hidden' value='MEAT'>