Back to top

Autore Topic: Interfacciare Facile forms a MisterEstate  (Letto 1503 volte)

Offline matrix845

  • Appassionato
  • ***
  • Post: 483
    • Mostra profilo
Interfacciare Facile forms a MisterEstate
« il: 09 Mag 2007, 22:58:47 »
Ciao ragazzi , vorrei creare un modulo analogo a questo : http://www.sfgate.com/homes/ , il problema non è tanto nel crearlo (usando facile forms che è il piu duttile per fare queste cose) , ma per interfacciarlo con Misterestate .
Ho visto che nelle opzioni di Facile forms , è possbile setatre 4 tipologie di script , prima e dopo del form , e prima e dopo il submit del form.
Se notate tra i form di esempio che Facile forms installa , c'è ne è uno , per prenotare i biglietti di un concerto rock , che inserisce dei dati 
nel db per ogni utente che prenota un biglietto...insomma si interfaccia con un componente.Secondo voi , costruendo uno script apposito ,con accesso alle giuste tabelle di mister estate , sarei sulla strada buona , oppure per fare un modulo di scelta immobile come quest'altro sito( http://www.realtor.com/ il find a home in alto al centro) devo procedere in altra maniera?
Grazie per l'aiuto!
Pierpaolo ;)

Offline matrix845

  • Appassionato
  • ***
  • Post: 483
    • Mostra profilo
Re: Interfacciare Facile forms a MisterEstate
« Risposta #1 il: 09 Mag 2007, 23:43:55 »
Nelle proprietà di un form , andate al tab "Script" e potre notare:
Codice: [Seleziona]
function ff_RnrContestRegist_init()
{
    if (ff_getElementByName('userid').value=='0') ff_switchpage(2);
} // ff_RnrContestRegist_init

in the form pieces , before from :
Codice: [Seleziona]
//+trace dis

// load the standard form creation utilities
$this->execPieceByName('ff_InitLib');

// create table if it does not yet exist
ff_query(
    "CREATE TABLE IF NOT EXISTS `#__rnr_contest` (".
        "`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,".
        "`userid` INT( 11 ) DEFAULT '0' NOT NULL ,".
        "`couple` VARCHAR( 50 ) NOT NULL ,".
        "`age` TINYINT( 1 ) DEFAULT '0' NOT NULL ,".
        "`acro` TINYINT( 1 ) DEFAULT '0' NOT NULL ,".
        "`fun` TINYINT( 1 ) DEFAULT '0' NOT NULL ,".
        "`boogie` TINYINT( 1 ) DEFAULT '0' NOT NULL,".
        "PRIMARY KEY  (`id`)".
    ") TYPE=InnoDB AUTO_INCREMENT=1"
);

// load old record if any
global $record, $my;
$rows = ff_select("select * from `#__rnr_contest` where userid=$my->id");
if (count($rows)) {
   $record = $rows[0];
   ff_setChecked('age', $record->age);
   if ($record->acro  ) ff_setChecked('acro'  ,'1');
   if ($record->fun   ) ff_setChecked('fun'   ,'1');
   if ($record->boogie) ff_setChecked('boogie','1');
} else
   $record = NULL;

submit pieces :
Codice: [Seleziona]
//+trace dis
global $my;

// load the standard submit utilities
$this->execPieceByName('ff_InitLib');

// retrieve the submitted values
$recordid = ff_getSubmit('recordid');
$userid   = $my->id;
$couple   = ff_getSubmit('couple', '');
$age      = ff_getSubmit('age',    0);
$acro     = ff_getSubmit('acro',   0);
$fun      = ff_getSubmit('fun',    0);
$boogie   = ff_getSubmit('boogie', 0);

if (is_numeric($recordid))
    // update existing record
    ff_query(
        "update `#__rnr_contest` ".
           "set `couple` = '$couple', ".
               "`age`    = '$age', ".
               "`acro`   = '$acro', ".
               "`fun`    = '$fun', ".
               "`boogie` = '$boogie' ".
         "where `id`     = $recordid"
    );
else
    // save new record
    ff_query(
        "insert into `#__rnr_contest` ".
            "(`userid`, `couple`, `age`, `acro`, `fun`, `boogie`) ".
        "values ('$userid', '$couple', '$age', '$acro', '$fun', '$boogie')"
    );

end submit
Codice: [Seleziona]
ff_redirectForm("RnrContestList");

Sto parlando del form di esempio di Facile Form"RnrContestRegist"



Grazie ragazzi  ;)

 



Web Design Bolzano Kreatif