[coldbox-5.2.0+791] html.entityFields and manyToOne

I have the following and html.entityFields is not rendering the field in question at all. What am I doing wrong…?

models\ThisModel.cfc

property name=“othermodelID” ormtype=“integer” fieldtype=“many-to-one” cfc=“OtherModel” fkcolumn=“othermodelID”;

views\ThisModel\editor.cfm

#html.entityFields(
entity = prc.ThisModel,
groupWrapper = “div class=‘form-group’”,
class = “form-control”,
fieldWrapper = “”,
labelWrapper = “”,
wrapperAttrs = {},
textAreas = “”,
booleanSelect = true,
manyToOne = {
othermodelID = {valuecolumn=‘othermodelID’, namecolumn=‘name’, sortorder=‘name asc’}
},
manyToMany = {},
showRelations = true
)#

Hi John,

i just did some quick coding to confirm that entityFields is working. Please find the follow code snippets and let me know if this works for you.

Form
https://pastebin.com/BUBkpv7G

Page.cfc
https://pastebin.com/CNmQNEyq

Book.cfc
https://pastebin.com/HmzyD5sX

Could you post you full code so we can be debug it? All are you letting coldfusion create/update your database for you?

Thanks, Ryan. The only differences I could spot between your code and mine are:

  • my models are extending cborm.models.ActiveEntity
  • my models’ non-ID properties all include ormtypes
    Would either of those things break html.entityFields?

It seems like if it is a new entity (eg, entityNew(‘Entity’) or ORMService.get(‘Entity’, 0) ), the HtmlHelper will skip rendering the property.

Im not to sure why this check is exists but you will have to save the entity first before the property renders.

Prehaps someone can shed some light on this behavior.

Actually you don’t need a persisted entity. It works off the metadata of the object, so it does not rely on the persisted object.

Luis, sorry, I don’t follow. What do I need to change in order to make this work?

By the way, I’ve confirmed this. My code works fine on edit, just not on create.

Can you send me the entities.

Luis Majano
CEO
Ortus Solutions, Corp

P/F: 1-888-557-8057

– -- – You received this message because you are subscribed to the Google Groups “ColdBox Platform” group. For News, visit For Documentation, visit For Bug Reports, visit — You received this message because you are subscribed to the Google Groups “ColdBox Platform” group. To unsubscribe from this group and stop receiving emails from it, send an email to . To post to this group, send email to . To view this discussion on the web visit . For more options, visit .

Luis, I sent you my models directly. Are you seeing what we’re seeing?

I got them. I have not tested yet. Trying to clear my plate. Will do so shortly