1 follower Follow

optional field gives error when no value entered via API


we are using podio to collect, store and manage data from our website. Whenever we have a form (not using podio forms, but costum html forms) that has optional from-fields, and these fields are not populated, we get the following error:

Error: Invalid field #### ('value'): Invalid value u'': Must be at least 1 characters long

This is the php code:

$podioapi->item->create($app_id, array('fields' => array(

"cat" => 7,

"message" => nl2br($_POST['message'], false),

"details" => $_POST['firstnmae'] . " " .$_POST['lastname'],

"email" =>$_POST['email'],

"phone" =>$_POST['phone'],

"date" => array('start' => date("Y-m-d H:i:s")),

"status" => 1),


In the above example the error would result from an empty email field...

When I enter data via podio I dont need to fill these fields. And how would the user fill this field with no data when using our webform.

Thank your for the help!

Michael Winterheller  

Michael Winterheller Answered

Please sign in to leave a comment.



Hi Michael

If the values are blank, you should simply leave them out of the "fields" array. So I suggest you start with an empty array, and then add the values if they are not blank, and the use that in the item-create call.


Christian Holm 0 votes
Comment actions Permalink

Hi Christian,

thank you for the fast response!! I can follow your approach but how do I go about the "wanted" empty fields... But maybe the behavior is different when using the update call?!

Thank you again for the reponse



Michael Winterheller 0 votes
Comment actions Permalink