Forums

How do I reference a field form a model in a form?

NickOg 04 Jun, 2013
Hi

I cannot work this out - I have tried all that I can think of
[mdlReceipts.feeYear]
[mdlReceipts][feeYear]
[mdlReceipts].[feeYear]

and more - I can't get it to work. The debug shows that the data is there and the form that it is referenced.

Stuck😟 🙄

[attachment=1]4Chrono00.png[/attachment]
[attachment=0]4Chrono01.png[/attachment]
GreyHead 04 Jun, 2013
Hi Nick,

I'm no quite sure what you need to do here :-(

It looks as though the data you want is in $form->data[mdlReceipts][feeYear] so the matching input name is mdlReceipts[feeYear] or possibly mdlReceipts['feeYear']

Bob
NickOg 04 Jun, 2013
Hi Bob

I just couldn't get the value read from the database into the model to appear in the form field. Fixed now - mdlReceipts[feeYear] is the one. That is,
modelname[fieldName]


One more down

Thanks
This topic is locked and no more replies can be posted.