Buy Now
Sign in

Default value doesn't work with array vars

healyhatman , October 18 2018, 12:25
healyhatman 8
October 18 2018, 12:25 #380895
Problem:
Say you have a read data action, model, and field. Using {var.jsonde:read_data#.model.field/0} SHOULD give you 0 if that field is empty, but instead you get NOTHING. Can't confirm if it's only read data vars that fail to return a defined default value, or just arrays in general.
If it's at all relevant I'm trying to do this in a repeater field so when the field has previously been entered it shows all the data, and if it hasn't it shows at least the first row waiting to be filled in.
Annoying Workaround:
Using a switch with data source {var.empty:read_data#.model.field} , false:{var:read_data#.model.field} (and nothing for true), and then using {var:switch/default}.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store