Is it possible to limit range of text input values?

418 views
Skip to first unread message

Dennis Baldwin

unread,
Jan 17, 2017, 4:35:07 PM1/17/17
to Blockly
Hi,

We currently have a block that uses a dropdown field for input. It's worked well for some time, but now we need to allow it to support more values. We'd like to change it to a text input field, but the problem is the range can be from -90 to +30 in increments of one. I haven't seen a way to limit what users can put into this field so is the right approach to check the value after the user enters it and then display an alert? Or is there another field that I haven't seen yet (like a slider) that make this more intuitive? Any insight would be much appreciated.

Thanks,
Dennis

Rachel Fenichel

unread,
Jan 17, 2017, 5:11:25 PM1/17/17
to Blockly
Hi Dennis,

Sounds like you need a number field!


If you enter a number bigger than the max, we'll cap it at the max value when focus moves away.  Similar with min.

The "Caution: Number fields are in development. While Android and generators properly support number fields, the web UI is not yet implemented" note just means that with web on mobile devices you'll see the normal keyboard instead of a number pad.

Cheers,
Rachle

Dennis Baldwin

unread,
Jan 17, 2017, 5:58:31 PM1/17/17
to blo...@googlegroups.com
Thanks, Rachle. Not sure how I missed this but it's incredibly helpful. One question I do have is that we're using a Blockly release prior to the introduction of this field. Is it reasonable to think I can plug this into our existing version or should I consider upgrading? If the latter, do you know of a good howto for upgrading Blockly? We're just not sure what to expect as it relates to backwards compatibility. I'm going to give this a try, but wanted to ask.

Thanks again,
Dennis

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/2VIq_3JD3ok/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rachel Fenichel

unread,
Jan 17, 2017, 6:17:09 PM1/17/17
to blo...@googlegroups.com
Have you made a lot of changes in core blockly, or are you just using it as an unmodified library?  If it's the latter, you should be able to just pull the master branch from github.

Cheers,
Rachel*

*I misspelled my name in a previous email.

To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

Dennis Baldwin

unread,
Jan 18, 2017, 2:16:04 PM1/18/17
to blo...@googlegroups.com
Thanks, Rachel! I was thinking as I was typing your name that it was a very unique spelling :)

We will update our project with the latest version of Blockly. We've been using Blockly for the past two years to control DJI drones. It's called DroneBlocks and is being used in schools around the country to teach STEM. Our app is freely available here:


and our curriculum can be found here:


Just wanted to share what we're doing. Blockly is amazing and kudos to you and the team for the hard work.

This is awesome stuff!

To unsubscribe from this group and all its topics, send an email to blockly+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/2VIq_3JD3ok/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages