using the api/quickform for custom input across mutliple tab

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

Postby roginald » Mon Oct 23, 2006 9:48 am

Is there a way to utilize the api to create an input form that addressed multiple tables and their relationships easily? I was thinking of this as I was about to write an input form on the front end of an application that is currently utilizing a dataface back end...any help would be greatly appreciated...and since I haven't mentioned it yet, thank you for a stellar application.

roginald
roginald
 
Posts: 24
Joined: Wed Dec 31, 1969 5:00 pm

Postby alanslleung » Tue Oct 24, 2006 9:45 am

Okay... this depends on what type of form you need to create, and what you consider "easy".

The "easiest" way to do this might be to create a relationship with all of the appropriate fields. Then you can use the df_create_new_related_record_form() function which generates a Dataface_ShortRelatedRecordForm object which is the same form used when adding new records in a relationship.

You can make it so that this relationship does not show up in your tabs by setting the action:visible property of the relationship to 0.

e.g.:

Code: Select all
$profile =& df_get_record('Profiles',array('id'=>10));
$form =& df_create_new_related_record_form($profile, 'Publications');

if ( $form->validate() ){
    $res = $form->process(array(&$form, 'save'), true);
    if ( PEAR::isError($res) ) {
        // There was an error in processing... do something.
    } else {
        // It was successful.. forward to a success page.
    }
}

$form->display();
alanslleung
 
Posts: 3
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 23 guests

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