I just submitted a Web Bug report: feedback://showreport?report_id=45692 - WebTextField Type Number Cannot Set with Commas
Example Project: http://CampSoftware.com/files/LongTerm/Xojo/WebTextFieldTypeNumberCannotSetwithCommas.xojo_binary_project
Steps: - Drag a WebTextField to a WebPage.
- Set the WebTextField Type to Number.
- Set the WebTextField Text to a number with a comma in it like “1,000”.
- Result is nothing in the WebTextField
See a number with a comma in the WebTextField.
The WebTextField shows nothing.
Stop using commas.
What browser are you using? The
input type="number" has different effects on different browsers.
For example, I’m using Safari. If I type a comma in manually, the stepper doesn’t recognize the field as a number anymore and will start it at 0 again. However, when testing on Firefox it recognizes the number and takes out the comma.
It may not be a Xojo issue, or one they can fix.
Your workaround seems accurate for now.
Good idea Tim. I tested with Safari. I just tried Chrome and Firefox with the same result as Safari.
I believe in a type number with locale US, comma is not considered a valid character. You should instead consider entry with only
1234567890. and format the number with the thousand separators in lostfocus.
Interestingly, I can type 1,000 and exit the field.
But NumbertTypeTextField.Text = “1,000” results in nothing in the field.
[quote=295682:@Hal Gumbert]Interestingly, I can type 1,000 and exit the field.
But NumbertTypeTextField.Text = “1,000” results in nothing in the field.[/quote]
To see how the browser handles that value, try to change it with the stepper.
As noted, Safari throws your value out, Firefox removes the comma, and Chrome is not welcome on my machine.
Chrome - the all consuming beast