Add custom fields/inputs unrelated to the database
Archived from the Xataface Users forum.
GrosBedo — Thu Dec 18, 2008 6:59 am
Hello,
Long time I didn’t come to this forum, but Xataface fulfilled all my needs
Just got a question: is there a way to add in the Edit form a custom field unrelated to the database ?
Concrete example: I want to put a checkbox to notify all registered users of the new article the admin is posting, if he checks the box. I know I’ll have to use triggers, but I just can’t figure out how to add a checkbox without having to create a fake row in the database.
Thank you much in advance !
shannah — Thu Dec 18, 2008 8:05 am
Yes. You can add a transient field via the fields.ini file for this purpose.
e.g.
- Code: Select all
[send_notification] transient=1 widget:type="checkbox" widget:label="Please check this box if you want to send out a notification"
Then in your beforeSave() trigger:
- Code: Select all
function beforeSave(&$record){ if ( $record->val('send_notification') ){ // do notification stuff here. } }
Hope this helps.
Steve
GrosBedo — Tue Dec 23, 2008 10:03 am
Thank you very much ! Exactly what I needed