grails - About bean of hasErrors -


assuming have following object in controller

objcollection = [obj1, obj2, obj3] 

and in each obj following

obj1 = [     input = value, inputa1 = valuea1, inputa2 = valuea2 ]      obj2 = [     input = value, inputb2 = valueb2, inputa3 = valuea3 ]  obj3 = [     input = value, inputc2 = valuec2, inputa3 = valuea3 ] 

and gsp looks this

<div class="control-group ${haserrors(bean: objcollection.obj, field: 'input', 'error')}">     <g:textfield name='input' value='${objcollection?.obj}'> </div>  <div id="subform" class="subcontainer">     <g:each var='obj' in='${objcollection}' status='a'>          <div id='obj${a+1}'>             <div class='subaccordion'>                 <div>                     <g:each var='objinstance' in='${obj}' status="b">                         <g:render template="miniform" model="[b:b, objinstance:objinstance]"/>                     </g:each>                 </div>             </div>         </div>     </g:each> </div> 

while template miniform

<div class="control-group ${haserrors(bean: objinstance, field: 'input', 'error')}">     <g:textfield name='input' value='${objinstance?.obj}'> </div> <div class="control-group ${haserrors(bean: objinstance, field: 'input', 'error')}">     <g:textfield name='input' value='${objinstance?.obj}'> </div> 

where name attribute changed using jquery input a1, a2, b1, b2, c1 , c3 upon form load.

now question is, did passed object bean on haserrors? because tried haserrors work somehow didn't work expectation.

did made mistake anywhere?

also did map object correctly every input in gsp? i'm not quite sure on how use safe operator '?' avoid nullpointer error.


Comments

Popular posts from this blog

javascript - IndexedDB error: Uncaught DataCloneError: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned -

amazon web services - When using Cognito credentials with AWS in a browser (javascript), keep getting "missing credentials" error -

c# - How to set the datatextfield value instead of the value on a drop down list? -