sql update - zend form handling of NULL from DB to form and back to DB -


i have db table various columns of various types including few decimal typed columns may or may not significant. read record database , through error_log output resulting associative array using serialize($dbarray) , can see columns have 'n' signifying contain null value. same array used in $form->populate($dbarray) "populate" form. upon submission, use error_log again serialize($dbarray) , columns in question have 's(1):0' value portion of serialize output.

this issue me because have validator greaterthan 0 fails when expect pass when not eter value particular element. elements not required elements , should run validator when entered , because null not returned gets run. somewhere null value converted 0 subsequently turned 0.00 in db.

any idea need form return null when nothing entered element. have element defined type 'text' use elements of nature. there varchars same db record returned null, , think recall date column keeping null value. these 'text' elements in form.

i @ tomorrow , debugging more, ideas might cause appreciated.

i have discovered can handled use of filters (zend_filter) , in process of doing now. return , specify details when have working, , if fail guess might question.

okay, filter worked. basically, defined element had add an

->addfilter('null')

which causes getvalue or getvalues return null rather empty string or 0 , needed. there number of variable/column types filter convert null , says works way php empty() function , when empty returns true filter return null otherwise returns contents are.

i hope helps avoid research time had put in.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -