shannah / xataface

Framework for building data-driven web applications in PHP and MySQL
http://xataface.com
GNU General Public License v2.0
138 stars 58 forks source link

Calendar in grid widget doesn't save #95

Open shannah opened 6 years ago

shannah commented 6 years ago

Using calendar on grid widget over a relationship with a table that has a mysql date field (calendar widget on fields.ini) produces empty result on saving. All the other fields save ok but date appears empty. I use these parameters: On parent table fields.ini

[expirations]
    transient = 1

    widget:label = "Expirations"
    widget:description = ""

    widget:type = grid
    relationship = expirations
    widget:columns = "date, amount, status"

On child table fields.ini

[date]
    visibility:browse = visible
    visibility:list=visible
    visibility:find = visible
    visibility:csv = visible

    widget:label = "Fecha"
    widget:description = ""

    widget:type = calendar
    widget:dateFormat = "dd/mm/yyyy"
    widget:firstDay = 1
    date_format = "%d-%m-%Y"
    widget:ifFormat = "%d-%m-%Y"

Using directly CRUD on table all works fine.

From https://groups.google.com/d/msgid/xataface/cbe09c95-2d7f-45b1-8c88-e566bf04be56%40googlegroups.com?utm_medium=email&utm_source=footer

carmaz79 commented 6 years ago

It only occurs when field is in metafields:order on relationship metafields:order = date On IO.php $trec->setValues($tval_existing[$tid]); echo "Saving ";prearray($trec->vals()); if ( $orderCol ) $trec->setValue( $orderCol, $tval_existing[$tid]['order']); echo "After ";prearray($trec->vals()); On saving all is okay. On After value loss Really is logic than metafield:orders can not be a date because this field must be a number. I propose to close this issue.

shannah commented 6 years ago

Thanks. Yes. That is the reason. I'm going to leave this open for now to remind me that I need to either improve the documentation so that users don't make this mistake, or improve the error messages to make it easier to track down - or both.