ENUM default value

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
gigakun
User
Posts: 99

ENUM default value

Post by gigakun »

Good Day all. Can someone advise me of this is expected behavior. I'm using an enum field (set at a db level) with values "Y" and "N" and default value set to null to make it not required at a project level. However even though all the enum fields are currently null, when the project is generated all records don't show blank. The current value is correctly empty but the view value shows as "N" or my label "No". Furthermore when I update a record and leave my enum field empty, the database field still gets updated and sets a value of "N". Can anyone advise? Thanks.

P.S. Y'all know I like squeezing in an extra question lol.

I've never seen anyone talk about it but whenever I open the theme page of my project all customizations are lost and the theme resets to default. I have to remember to export and import every time if I have additional changes to make. Is this not saved in the project file?


arbei
User
Posts: 9422

Post by arbei »

  1. Set the Edit Tag to "RADIO" or "SELECT" so that the default value will not default to "Y"/"N"
  2. Theme settings should be not reset. Make sure that you did not change the HTML -> Theme setting manually.

gigakun
User
Posts: 99

Post by gigakun »

I always leave out a key piece of info when writing up these stuff my bad. It already was set to radio. Fields in the project are set to radio by default when enum is detected. But out of curiosity I set it to select. Same thing. Db field is currently null yet the view value of the field says "No". Likewise when i save the record without selecting a value of the radio button (Yes/No) the db value gets set as "N".

Upon further testing I realized this only happens when the ENUM values are set to "Y" and "N". If I spell it out "YES" or "NO" everything works as expected. So yay I'll just spell it out.

Weird the theme thing as always happened for me even since v2019. If I open the theme tab right now my custom background color would be lost etc...


mobhar
User
Posts: 11753

Post by mobhar »

  1. Please post your table schema for more discussion.
  2. Please post your Field setting for that ENUM field type for more discussion.

arbei
User
Posts: 9422

Post by arbei »

When the ENUM values are set to "Y" and "N" (or "1" and "0"), PHPMaker considers it as a boolean field (Y or N only, no NULL) and use CHECKBOX for it by default.


Post Reply