Ben's Blog

I.T., web development ben November 20, 2013

Pulling the number keyboard in iOS' Safari while disabling client side input validation

Safari on iOS allows you to pull a specific keyboard for an input field. For example if I have a field expecting numeric input, we’ll make sure that our input has the attribute of “number” rather than the usual “text” as such:

[html]<input type="number"/>[/html]

This will save users a few clicks; however Safari forces input validation on the client-side when you do that. Meaning if you wanted a numeric keyboard by default while allowing other characters, you input will fail.

IMG_0798

Not only is it highlighted in red, this.value also returns null as opposed to what is clearly in the field, rendering it unusable.

When the field is set to “-10”

Screen Shot 2013-11-20 at 10.14.10 AM

When the field is set to “+10”

Screen Shot 2013-11-20 at 10.14.03 AM

One would think that explicitly defining a pattern to check for would let Safari know that we are interested in trumping its input validation but such is not the case. As a result, the following does not help our cause:

[html]<input type="number" pattern="(-+){0,1}[0-9]{1,}">[/html]

So here’s a completely hackish way to get the keyboard you want with no input validation:

[html]<input type="number" pattern="(-+){0,1}[0-9]{1,}" onFocus="that=this; setTimeout(function(){ that.setAttribute(‘type’,’text’); },10);" onBlur="that=this; setTimeout(function(){ that.setAttribute(‘type’,’number’); },10);"/>;[/html]

That’s right, after iOS pulled the right keyboard, we change the field type to “text”. Note that the client will still display some red around the field as it will perform the validation but at least this.value will return what’s in the friggin’ field.

Note 1: the setTimeout is necessary, if we perform the change immediately onFocus, safari pulls the text keyboard.

Note 2: the that=this indirection is necessary to save a reference of the object to the context of setTimeout.

I.T., miscellaneous, video games ben November 16, 2013

Protected: 3 years

This content is password-protected. To view it, please enter the password below.

hunting, self sustainability ben November 16, 2013

A great day

having great fun with a great friend.

 IMG_1214

It was hard not to fall asleep on a day like this

IMG_1208

The cool thing about hunting is that failure still means you got some awesome hiking done.

miscellaneous ben October 11, 2013

Safe sex, beaconning through the night

Hard to see but 2 condom vending machines are blinking away their presence on the side of a wall in the middle of the night.

[flv:http://ben.akrin.com/wp-content/uploads/2013/10/IMG_0503.MOV.flv 640 426]

miscellaneous ben October 11, 2013

Welcome to France!!!

A massive 4-sided display of nothing but cheese. This is how it’s done.

miscellaneous ben October 10, 2013

I found my childhood right where I left it

miscellaneous ben October 10, 2013

Welcome to France!

 

self sustainability ben September 29, 2013

Applesauce yum

self sustainability, wood ben September 29, 2013

Wooden bridge to more wood part 2

This Subaru has hauled anything from motorcycles, compost & chicken coops; it’s only suiting to give it another job.

 This 90° turn was a huge bitch.

Almost there.

I’m not sure what I’ll do for boards yet, probably more hemlock cuts. I can’t wait to have it ready to use!

self sustainability, wood ben September 28, 2013

Wooden bridge to more wood part 1

A stream prevents us from taking the motorized wheelbarrow to 90% of the land where good fire wood is. It’s a herculean task to carry it all back across the stream and I’m no Hercules. My landlord tells me that hemlocks take water pretty well and we just dropped 2 huge ones for a clearing. It’s time to make a bridge.

Using a come-along inch by inch; thankfully it was hauled by a car for half of the trip

Getting ready to cross the stream

The tipping point

We’ll want a vertical component on that sucker

Hurray! One more to go…

poultry, self sustainability ben September 28, 2013

Layer coming online

life in the U.S., self sustainability ben August 19, 2013

How is this not a more common mode of transportation?

agriculture, self sustainability ben July 28, 2013

Today was a good day

agriculture, self sustainability ben July 20, 2013

Blueberry time

life in the U.S. ben July 20, 2013

Hey guys…

guys…

 guys listen…

I know what this fair with children running around needs…

a FIRE!

guys, a fire… in a PIT!

 

I’m pretty sure that’s how the conversation went.

agriculture, self sustainability ben July 15, 2013

The harvests are finally rolling in

With our late start and the crazy rain, it won’t be a great year.

poultry, self sustainability ben July 09, 2013

A tough job to say the least

 

 

I.T., miscellaneous, web development ben June 26, 2013

A website to make the meal math easier on the parents

https://yum.akrin.com

List of current features:

  1. It uses the USDA National Nutrient Database as the basis for all the foods you can search (your tax dollars at work).
  2. You can add your own recipes, ingredients whatever else is not in the base database. We find that we add all the foods we use even if it’s just bread because a bread with a label is always more accurate than the generic/average bread as defined in the USDA database. It’s also nice for adding your family specials once and for all and never have to do the math again.
  3. What you add is not shared amongst users and it only visible to you.
  4. It tries to learn which foods come back to help pick them later on.
  5. It remembers which amounts you last used
  6. Calculates insulin dose on the fly
  7. Very simple & streamlined navigation for the least work for the parents

This is still very much a work in progress but has made our meals a lot more agreeable already.

self sustainability, wood ben June 23, 2013

I still don't know how to measure wood amounts in cords

But I estimate this to be around a metric shit ton.

apiculture, self sustainability ben June 22, 2013

Brood, brood as far as the eye can see

7 Frames full of brood recto verso. Looks like the queen finally took it upon herself to lay some serious egg. In the course of next week I expect the colony to triple in size which will put us on par with last season.

poultry, self sustainability ben June 21, 2013

Freedom rangers

25 of them and they all made it through the bowels of USPS. As I introduced them to their new living quarters, I dipped their beaks into the water so they knew where it was right away. They were all quite thirsty traveling all the way from Pennsylvania.

We ordered them from Freedom Ranger Hatchery (have a link), they were excellent to deal with.

agriculture, poultry, self sustainability ben June 09, 2013

Machetes have a bad rep,

but they can clear some serious bush.

This whole area was reclaimed along with the ancient logging road leading to it. This is where the chicken coop will go, rotating the fenced-in area for the chickens with the garden each season.

I wish I had a picture of what it looked like before.

agriculture, self sustainability ben June 09, 2013

The garden this year

Nothing major but pretty decent.

Posts pagination

← Previous 1 … 43 44 45 … 52 Next →

This blog is solar powered

Interactive

Handwriting Capture
Mandalagaba
IPv6 link-local to MAC converter
IPv6 MAC to link-local converter
Markov Text Generation
Markov Word Generation
Markov Music Generation
Duplogrifier
Flood Fill Algorithms
Homestead Metrics
RGB Playground
Web Games

Categories

  • aesthetics111
    • plots54
    • specular holography6
  • Books4
  • I.T.203
    • 3D modeling / printing21
    • AI6
    • all out geekery36
    • electronics27
    • homestead automation6
    • maniacal paranoia26
    • plotters49
    • unix / linux29
    • video games4
    • web development29
    • web games3
  • Lego / Duplo67
  • life in the U.S.42
  • miscellaneous204
  • nature encounters115
  • old vinyls3
  • organs2
  • self sustainability563
    • agriculture107
    • apiculture38
    • apple20
    • building132
    • canning3
    • crochet6
    • foraging6
    • hunting10
    • maple syrup47
    • poultry39
    • preserving2
    • solar power28
    • water23
    • wood84
  • trip to a new life6
Theme by Bloompixel. Proudly Powered by WordPress