Stacks developers - does Stacks 4 'clearValue' work with number fields?

Does anyone know if “clearValue” (http://api.yourhead.com/controls/number/index/#clearValue) works with number type fields? The documentation above seems to imply it should… but it doesn’t seem to…

I’m having trouble with a stack not clearing ‘number’ fields when I delete the value… it just reverts to 0, but I need the field to actually remain empty, not default to 0. Once a number is entered into a number field, the field can’t be emptied any more… text ‘Input’ type fields can be, but it seems number fields can’t…

Can anyone please verify that for me?

Thanks in advance,

J.

Hi Jason,

First off, let’s tag @isaiah so he can pipe in with a definitive answer.

Secondly, You’ll probably have a better chance of getting this kind of technical stack development questions answered over on the Yourhead slack channel. If you are going to do stack development your going to want to join there anyway.
Information on joining can be found on this post.

Finally, my take on the question, I think since the field is numeric, it will return a number. There are other internal things like template variables (like Integer Math, or Integer Comparison) and the math control that wouldn’t work without a numeric value.

Thanks Doug - I only discovered there was a Beta build available in the last half an hour, and sure enough, it looks like it’s a bug (or documented but not implemented feature) in the 4.0.4 public release of Stacks… It’s been fixed in the beta, so now you can delete the values and return them to blank… I’ve just let @yabdab know as well, because it was affecting the PaySnap stack interaction with PayPal.

I wasn’t actually sure where the problem lay though, if it was a system issue, Stacks issue, PaySnap issue, or something I had running in the background…

Just for clarity, the clearValue does not refer to a blank input field. The clearValue is the value inserted into the control when the user clears the current value (by deleting it and either hitting enter or focusing another control).

The bug (that I reported) was that the value specified by the stack developer was not being inserted when the user cleared the field. This is now fixed but it would not appear to be relevant to what you are reporting as anything with a clearValue specified in the pList of the stack will by definition now not allow a blank value.

In addition to this, whether something can be blank depends on the type of content. A number field cannot be blank as there is no such thing as a blank number (only zero). An input (text) field can be blank as an empty string is still a valid string.

3 Likes

Hi Andrew,

PaySnap uses number fields and they’re blank to begin with… Both PaySnap 2 and PaySnap 3 do, actually… Maybe they shouldn’t be number fields, but they are…
I tried converting them to input fields and PaySnap still worked, but its not my stack, so any future update might revert them back to number fields…

Unless @yabdab makes the same change, then the next or any other update will change it back. I’m guessing he’ll make a similar change.

Hopefully you made the changes to a copy of the stack.

If you can change the CFBundleIdentifier to your own unique value and delete the SUFeedURL plist entry from your copy they both can reside in the stacks library until there’s a permanent fix.

3 Likes

Brilliant advice! Thanks!

1 Like

I’m late here – there’s something here in the US that’s kind of been occupying my attention for the past couple days… :open_mouth::grimacing::dizzy_face:

Anyway, it sounds like Tav got you sorted explaining the situation and the bug that Tav reported and i fixed (I hope).

And yes, changing the Bundle ID makes the stack your own.

But I’d also send a copy to Mike and show him what you did. Maybe he’ll just incorporate these improvements and release a new version. I, for one, love it when techy users send me pre-solved bugs like this. It makes your job as a developer a lot easier.

But, do be patient with folks in the US right now. It’s pretty crazy here this week. Hopefully things will settle down a bit in a few days. :slight_smile:

Isaiah

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.