grails Command Object deep data binding -



grails Command Object deep data binding -

i have 2 domain objects , 1 command looks like

class vendor { string phonenumber public string tostring() { """[phonenumber: "${phonenumber ?: ''}"]""" } } class product { string productnumber vendor vendor public string tostring() { """[productnumber: "${productnumber ?: ''}", vendor: "${vendor}"]""" } } class saveproductcommand { product product }

i have form looks like:

<g:formremote> <input type="text" name="product.productnumber" value="12345" /> <input type="text" name="product.vendor.phonenumber" value="18005551212" /> </g:formremote>

my controller phone call looks like:

def save(saveproductcommand cmd) { // stuff }

when examine product see like:

[productnumber: "12345", vendor: "null"]

is grails able info binding on multiple levels? if so, can see doing wrong? if not, can offer work-around?

yes, command object binding works arbitrarily deep nested paths. may have typo or else in app problematic, binder back upwards talking about.

see sample app @ https://github.com/jeffbrown/simplebinding. if submit form on default index page see both properties bound properly.

grails

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -