valan Posted September 27, 2016 Share Posted September 27, 2016 There is FieldtypeFleat field "my_float_field" with setting "Blank and Null have different meanings". I have few (strange) issues with it. (1) Issue number 1 When I want to store null in this field, it doesn't save (or return) null. I want to get null back when I save null and 0 when I save integer 0. What's wrong here? $value = null; echo 'Type=' . gettype($value) . ' Value=' . print_r($value, true)); $page->setAndSave('my_float_field', $value); echo 'Type=' . gettype($page->my_float_field) . ' Value=' . print_r($page->my_float_field, true)); echo 'Type=' . gettype($page->my_float_field) . ' Value=' . print_r($page->getUnformatted('my_float_field'), true)); // Result: Type=NULL Value = Type=double Value = 0 Type=double Value = 0 (2) Issue number 2 This field has Visibility=Open+Closed when blank+Locked If I save null in this field, it disappearas from page edit admin. If there is some value - it shows it normally... If I change setting "Blank and Null have different meanings" to "... equivalent" it also does not help. This looks like either bug or some db issue. I've checked field settings in db and didn't find any strange things there... so tend to think that it is bug. Or I don't understand smth... Please help. Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 27, 2016 Share Posted September 27, 2016 Part 2 is probably because visibility settings are evaluated in js only, which ultimately doesn't know anything about the setting of the field. Link to comment Share on other sites More sharing options...
Robin S Posted September 27, 2016 Share Posted September 27, 2016 5 hours ago, valan said: There is FieldtypeFleat field "my_float_field" with setting "Blank and Null have different meanings". There's no such setting is there? I think you mean "Blank and 0 have different meanings", which doesn't promise anything about blank and null being treated differently. I guess PW treats these as equivalent, which explains issue 2 also. Link to comment Share on other sites More sharing options...
valan Posted September 27, 2016 Author Share Posted September 27, 2016 28 minutes ago, Robin S said: There's no such setting is there? I think you mean "Blank and 0 have different meanings", which doesn't promise anything about blank and null being treated differently. I guess PW treats these as equivalent, which explains issue 2 also. Yes, Blank and 0 have different meaning. I guess Blank for float = Null. Anyway, hiding field if it's value is null is not expected behavior I think. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now