Add custom fields/inputs unrelated to the database

A place for users and developers of the Xataface to discuss and receive support.

Add custom fields/inputs unrelated to the database

Postby 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 !
GrosBedo
 
Posts: 16
Joined: Wed Aug 13, 2008 10:44 am

Postby 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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby GrosBedo » Tue Dec 23, 2008 10:03 am

Thank you very much ! Exactly what I needed :D
GrosBedo
 
Posts: 16
Joined: Wed Aug 13, 2008 10:44 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 29 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved