Using decimals in a web number textfield

Good day.
I am using a web number textfield. (the one with the up/down arrows) the arrows increment the number in the field by 1 on each click. Can I alter this to 0.1? In other words, I want to use decimals in the field.
Thanks

For some odd reason, it appears the developer of the “Web Number Textfield” designed it only to work with integers. It probably should have been more aptly called a “Web Integer Textfield”.

So the answer to your question appears to be no. You cannot change the “Web Number Textfield” to increment by anything other than 1.

I’ll leave it to other to suggest that you could roll-your-own control and how that may be accomplished.

I just experimented with the HTML 5 control which is the base of that control at http://www.w3schools.com/html/html5_form_input_types.asp

It works the same : values increase or decrease by 1.

I tried a workaround by using a transparent number field with text color transparent as well containing the value in a UInt64, which is copied divided adequately to produce a fractional part in a regular TextField underneath that shows through.

It works, but the issue to roll a custom control using the standard controls is latency. When clicking on the arrows up and down, it takes 1/4 to 1/2 a second to update. The only way to have a decent time response is to use client side JavaScript. And that is a whole different ball game.

[quote=129143:@Peter Jais]Good day.
I am using a web number textfield. (the one with the up/down arrows) the arrows increment the number in the field by 1 on each click. Can I alter this to 0.1? In other words, I want to use decimals in the field.
Thanks[/quote]
File a feature request.

It’s more a matter of not fleshing out enough of the parameters.

Keep in mind though… different browsers implement these fields differently. For instance, on iPad there is no stepper and it is simply displayed as a text input field.

Thanks for your replies. Its a pity, but I think Xojo could change this to work with decimals as well. To get around the matter I have made my own numeric text box. It works but I don’t know how to make it alter values continuously (I think the term is Fire), so I have to reach de desired value by single clicks, which can take some time. Can someone tell me how to do this?

[quote=129217:@Greg O’Lone]File a feature request.

It’s more a matter of not fleshing out enough of the parameters.

Keep in mind though… different browsers implement these fields differently. For instance, on iPad there is no stepper and it is simply displayed as a text input field.[/quote]

I should have been more clear. My point was not about the stepper. It was about the Web Number Textfield in general. You cannot enter a floating point number without it flagging it as an invalid. For example, if you enter “1” into the field, all is well. If you enter “1.5”, it is flagged as invalid. That is why I said it should be more aptly named a Web Integer Textfield.

Right, but if we fix the stepper problem, I suspect the field will allow decimals as well. The control is an HTML5 input field and it does its own verification, so fixing one will likely fix the other. Make sure you put an example project on there and tell us which OS and browser are showing the problem you’re seeing.

This is not my experience with Chrome and Safari on Mac, which accept the decimal without any error. Same thing for the HTML 5 number field.

You can monitor the mouse button status and position with System.MouseDown, MouseX, MouseY. Use a timer to monitor that and change the value at intervals of 1/30 th a second or so (that is the rate of autorepeat for some keyboards).

I almost exclusively working on the Windows platform and do not have any Apple hardware of my own (and have no desire to either). So all of my observations come from a Windows perspective.

Greg has already said that the Xojo control is an implementation of the HTML5 control. According to the HTML5 spec, that control handles floating point numbers. Given what you’ve said about it working correctly with Chrome and Safari on that MAC, that would lead me to believe that it was Xojo’s implementation that is the issue here. It appears that it has been implemented without thought of being able to enter floating point numbers or the ability to increment by values less than 1.

It is not as simple. You did not notice above I have already played with the HTML5 Number Input Type, and I did again now at

The HTML5 control does exactly the same as Xojo, meaning it increments by integer, no matter the step chosen for the input. Incidentally, the step value may explain validation errors.

This accepts any decimal :

 <input type="number" name="quantity"  min="0.00" max="5" step = "any">

For more see http://www.w3.org/TR/html-markup/input.number.html

I happen to have a wider perspective, as I do not limit myself to any one system. As a matter of fact, this is typed on the PC under Windows 8.1 64 bits I just used to see what happens on that platform. And I could do the same under Linux Mint if needed.

How do you see floating point numbers flagged as invalid ? From what I see with Internet Explorer 11 and Chrome Windows, no error upon typing. The flagging must be the result of the program validation rather than the control itself.

Try it using the latest version of Firefox. When you enter a floating point number, the textfield’s border turns red signaling that the validation routine has flagged it as invalid. Also, when you mouseover the field it says something to the effect that it must be an integer.

Obviously, different browser have different levels of support for the HTML5 input field. It probably even varies by which particular OS the browser is running under.

I should add that the result is under Firefox v32.0.1, using the latest version of Xojo, under Windows 7, running within the Xojo IDE. Basically, I just placed a Web Number Textfield on a window and ran the web app in the IDE.

By the way, I get the same red border result when trying it on the W3Schools site that you referenced above.

Indeed, Firefox does something that other browsers don’t, which is to validate input when the field loses focus.

As you can read below about the HTML5 control at W3School, adding step = “any” fixes it. Seems easy enough to implement in Xojo.

You may want to file a bug report, so Xojo looks into it.

[quote=129328:@Randy Baskin]By the way, I get the same red border result when trying it on the W3Schools site that you referenced above.
[/quote]

You forgot in the HTML source the magic word I posted : step = "any" which makes the red disappear as surely as Visine for the eyes :wink:

<input type="number" name="quantity"  min="0.00" max="5" step = "any">

Just add that in the left box and click “Submit” before entering decimals again. Then enter a floating point number, and get back to the editor, no red.

You are correct. Probably while you were drafting your response, I went back and made that change. And as you said, it was able to accept floating point numbers without error. As a matter of fact, I tried “.5” as a step and it works well with the stepper too.

:slight_smile:

Unfortunately, I no longer feel any vested interest in helping Xojo resolve their bugs. As I mentioned in another topic, I don’t use Xojo and only rarely use RS2012r1.2 any more, which is the latest stable version that my Pro license allowed. For many reasons, I have given up on Xojo being able to meet my needs and expectations. And that is fine. Like I said, I primarily write applications and utilities for the Windows platform. I also have written several web applications. It is quite clear that Xojo, the company, spends most of its time and efforts staying relevant in the Apple arena. Windows and Linux seem to be treated like unwanted but tolerated stepchildren.

Many of the Xojo bug reports that I’ve written or contributed to in years gone by are, remarkably, still unresolved. Therefore, at least to me, creating new bug reports would be a waste of my time and efforts. Unfortunately, due to the 2012 Xojo IDE debacle, that basically wasted almost half of the value of my subscription, I doubt that I will ever give Xojo another dime. Before you say, have you tried contact customer service? The answer is yes and with no acceptable results. So until Xojo compensates me for the value of my subscription that they wasted away, which I’m sure will be never, Xojo is not a tool that I plan to use in the future.

The only thing that really keeps me hanging around the community and contributing every now and then are the glimmers of greatness that I see in the product. Unfortunately, those glimmers of greatness seemed to be too few and far between and almost completely overshadowed by the numerous attempts that come up so short. It’s so unfortunate because I was such a fan years ago. 2012 was just the straw that broke the camel’s back. :frowning:

You may want to have a look at what I just wrote here : https://forum.xojo.com/15697-running-xojo-project-without-building-it?search=extirpate

That said, I still do appreciate Xojo and do like its IDE. I cannot comment your personal taste and what you consider a waste.

I am not quite sure Web Edition is such an abandoned child, though. I have seen Greg O’Lone going out of his way time and again to fix bugs quickly and efficiently, and offer constant support.

So I have filed a bug report with the number field issue you helped discover. Not for me, I have no use for such a control at the moment. For the community. Call me old fashion, I tend to think altruism is a virtue.

<https://xojo.com/issue/35351>

Yes, I was monitoring that thread too. I think I even clicked “Like” on your particular post. I’m sure there are many people like me that do much more reading of the forum than contributing. And many of those are Windows users and developers that probably do not feel as comfortable posting here due to the biases towards Apple. Thanks for such posting such a well-worded synopsis of how some of us feel regarding Windows-related enhancements (or lack there of) to Xojo.

Actually, Web Edition, is one of those glimmers of greatness that I was referring to. For the most part, I like it and use it when it fits the need. It still has a ways to go, but it is a great start to becoming something truly spectacular. Fortunately, the RS2012r1.2 version was usable for me. If anything were to bring me back into the fold sooner rather than later (or never) it would most likely be Web Edition.

But like I said, due to what happened to my subscription due to the 2012 debacle surrounding the release of the new IDE and their refusal to take responsibility for their decisions, I doubt that I will ever take another chance on Xojo. They would have to earn back my business. And given the response from Customer Service regarding the issue, on 2-3 attempts to allow them to rectify the issue, I doubt that I will ever happen. That turned me off to Xojo, the company, so much so that I actually try to dissuade those that I know from purchasing the product when asked for my advice. I don’t actively go out a rail against it. But I let them know my personal experiences with the product and the company.

I’m sure that those more invested in Xojo appreciate your efforts in making sure that the issue was documented.

:slight_smile:

Michel

I thank you for your reply (Sep 14)
My Question
" Thanks for your replies. Its a pity, but I think Xojo could change this to work with decimals as well. To get around the matter I have made my own numeric text box. It works but I don’t know how to make it alter values continuously (I think the term is Fire), so I have to reach de desired value by single clicks, which can take some time. Can someone tell me how to do this?
Your reply
You can monitor the mouse button status and position with System.MouseDown, MouseX, MouseY. Use a timer to monitor that and change the value at intervals of 1/30 th a second or so (that is the rate of autorepeat for some keyboards).

I have tried to do what you suggested, but I don’t know how to. I can’t find information in Xojo documentation about using System.MouseDown etc. Could you explain this to me? - Thanks

I am using a segmented control
This is my code:

Select Case SegmentIndex

Case 0
dim a as double
a=val(label1.text)-.1
label1.text=str(a,“0.0”)

Case 1
dim a as double
a=val(label1.text)+.1
label1.text=str(a,“0.0”)

End Select

See an example: http://67.207.152.78/Test100923-Dev

Unfortunately, I had forgotten that system.MouseDown is not available for Web Edition.

The other way to do that is as follow :

  • Add two boolean properties to your WebPage : PlusT and MinusT
  • Add the event MouseDown to your segmentedcontrol
  • In that event, if the position of the mouse is less than 50% of the control width, set MinusT to True, otherwise PlusT to True.
  • Add a MouseUp event with MinusT = False and PlusT = False.
  • Add a timer to the WebPage, multiple, with a period of 300
  • In the Action event of the timer, something like that :

if PlusT = true then Textfield1.Text = str(val(TextField1.Text)+0.1) Elseif MinusT = True then Textfield1.Text = str(val(TextField1.Text)-0.1) end if

As long as you maintain the mouse button down, the value changes.