Buy Now
Sign in

Field Value

itpates , September 17 2018
itpates 116
September 17 2018 #380210
I have Form Fields set up to pre-populate with data using Model[field] for editing existing entries, and that works perfectly. I'd like to use those same Form Fields in a blank form to create a new entry. Is there a way the Value can be conditional on whether there is data to populate it so it does not display Model[field] in a new entry form. A sort of "if there is data, display it here, if there is none, display nothing." Or am I going to have to create redundant Form Fields?
GreyHead 63.5
September 17 2018 #380224
Hi itpates,
Is this a ChronoConnectivity question or a ChronoForms one? I suspect the latter.
Normally ChronoForms will populate form inputs with any matching data that is in the form data when the form loads and will otherwise leave the inputs empty,
BUT sometimes you want to have slightly different ways of handling new entries and edit entries e.g. with uploaded files. In that case it can be simpler to use two forms.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
itpates 116
September 17 2018 #380226
Chronoconnectivity. But thanks.
healyhatman 6.0
September 18 2018 #380235
You should be able to use the same form - if {var:read_data.model.field} is empty, the value will be empty - no pre-population. But you'll probably want to have the event that the submit button points to be different depending on if you're editing an entry or saving a new one. Maybe have a hidden "id" field and in your submit event, check if the value is empty and using a switch action call either {fn:save_data} or {fn:update_data}
Web developer at
I don't work for ChronoEngine but I do accept donations

You can now copy+paste code from forums
itpates 116
September 21 2018 #380412
Works perfectly. I had it with MODEL[field] because that's the way I saw it done in examples. The {var:read_data.model.field} works just as well and allows me to re-use those fields. Handy. It's not calling another database read, is it? I assume the MODEL[field] was just reading from the array returned from the single database read.
The database save function can detect between a new or a save and the ID database field is set to auto-increment if empty data is sent to it, so that works out well.