How do you do <input type="number" /> in Native Base? - native-base

In HTML, you can use <input type='number' /> to restrict the user's input to numbers only. It also adds little increment/decrement numbers on the input field. Is there a way to do this in Native Base (v3.2.2)? What is the associated onChange property (onChange, onChangeText, onValueChange, etc.)?
I have scoured the official documentation and have found nothing.

I tried to find the issue and turned out that react-native-web ( one of NativeBase core dependencies) is not passing the props to the HTML Input.
I have created a PR for its fix.

Related

Using URL parameters for webforms that seem to be resistant to them?

I'm attempting to write a little script that, as part of it, would automatically complete a webform using data from a dictionary.
I've developed this script for other forms in the past with a pretty simple setup: the elements in the form are identified with a line like...
<input type="text" name="full_name" id="full_name_id" maxlength="80" value="">
<input type="text" name="title" id="title_id" maxlength="80" value="">
So, I'd navigate to www.theformsite.com/theform.php?full_name_id=David&title_id=Stuff and find those slots already filled in.
For a couple new forms I've been working with though, that doesn't seem to work: there's no response to these parameters. Are there any general things that could prevent this from working that I should check on?

Is ASP.NET MVC's Checkbox Implementation Accessible / Screen Reader-Friendly?

If you've ever looked at what ASP.NET MVC actually renders when you use #Html.CheckBoxFor, then you've seen that each checkbox you request to be rendered actually results in the emission of not one but two input tags. One is the "true" value checkbox, and the other is for "false." The latter input is of type "hidden".
Generally this doesn't cause problems if you're using ASP.NET MVC correctly. You wouldn't notice the input doubling unless you tried to, for example, do something directly with Request.Form(e.g. Why does ASP.NET MVC Html.CheckBox output two INPUTs with the same name?)
My question, though, is how screen readers deal with this. For example, can they be relied upon to correctly report only the visible checkbox to the site user?
Screen readers will ignore hidden inputs.
Given the example you cite in your comment, it returns this code:
<div class="col pure-u-xl-1-3 pure-u-lg-1-3 pure-u-md-1 pure-u-sm-1 pure-u-xs-1">
<label>Home Club Newsletter</label>
<input checked="checked" … id="newsletter" name="JoinHomeClub" type="checkbox" value="true">
<input name="JoinHomeClub" type="hidden" value="false">
<span class="checkbox-label">Yes, please sign me Up!</span>
</div>
Right off the bat there is a problem here because the <label> is not associated with the control, and the visible text that is next to the checkbox is not associated with the field.
When I access the field in NVDA, all it says is "checkbox checked". There is no accessible name at all.
But to your question…
Your question was related to the <input type="hidden">. As #SLaks said, screen readers ignore <input type="hidden">. The fact that they have the same name value is no problem. If they had the same id value, then you would have a problem (how it would manifest in a screen reader depends on things and stuff).

XUL: how to persist a value of a textbox?

I have a Firefox extension that contains a textbox:
<textbox id="exclude-text" flex="1" rows="10" multiline="true" style="min-width: 25em;" wrap="off" value="0" persist="value"/>
A user enters some text in the text box. I need this text to persist across sessions.
I found this info on the "persist attribute", but in my case it does not work.
Is there any way to make it work or any simple workaround?
Thank you!
The persist attribute can only store attributes - yet the value attribute of a text field doesn't change when text is being entered, only the value property. As far as I know, the only work-around is keeping the value attribute in sync with the value property manually, something like this:
<textbox id="exclude-text" value="0" persist="value"
oninput="this.setAttribute('value', this.value);document.persist(this, 'value')"/>
Calling document.persist() is necessary unfortunately, changing attributes manually normally doesn't trigger persistance.
For reference: this is bug 111486, a XUL limitation first noted in 2001.

grails - bug in scaffolded view generation for Floats (Grails 2.0 RC1 - RC3)?

If one has a Float field in a domain class, the Grails view generation uses a
<g:field type="number" />
and one gets a
<input type="number" />
type of html field, which purely allows integers .... unless I'm just unable to get it to work differently.
Can one override the scaffolded generation to use something else for Floats, e.g. a simple text field, so that a floating point value can be entered?
Thanks
P.S. I can't find any documentation on the g:field tag, apparently new in this release. Can you refer me to any reference you've seen or include the documentation in this post? (if available)
Voting for the bug in the Grails bug-tracker might help get it fixed. There's also a workaround
This could be fixed by using the widget constraint which allows you to define a custom html element to be generated by scaffold.
Exp:
description widget: 'textarea'
http://grails.org/doc/2.2.x/ref/Constraints/widget.html

Why use <g:textField /> in Grails?

What is the reason to use g:textField in Grails if you're already familiar with standard HTML form tags?
If I understand correctly the following two markup alternatives are equivalent:
<input type="text" name="name" value="${params.name}" id="name" />
<g:textField name="name" value="${params.name}" />
Are there any circumstances under which using g:textField would add value? Am I missing something?
The textField tag is provided as a convenience (slightly shorter than writing the HTML input) and is there to provide a full set of form tags. Personally I prefer to write as much plain HTML as possible in my Grails views and only tend to use the tags that really offer a benefit such as the form tag. I have not found an instance where using textField would have added any value outside of requiring a few less characters to type.
<g:textField /> is not shorter as plain text field tag, except id attribute will be attached automatically.
However, I recommend you to use customized tags associating the bean values with input fields. That shortens the code a lot. For more information you can read http://www.jtict.com/blog/shorter-grails-textfield/
Also you can find useful stuff in Form Helper Plugin

Resources