Quote:
lesage wrote:
i have the same problem with XoopsFormDateTime
i can'T get the enter or selected date.
Please when you find some answer let me know.
Try using 'XoopsFormTextDateSelect' rather than 'XoopsFormDateTime' at the moment, there seems to be an issue somewhere when rendering the form via smarty, it seems ok if you do it the other way.
Working method but not with smarty:
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$edit_form = new XoopsThemeForm( "Edit", "edit_form", "edit.php" );
$descrizione = new XoopsFormTextArea( "Descrizione", "descrizione", $eo_descr, 10, 100, "desc" );
$edit_form->addElement( $descrizione, true );
$data = new XoopsFormDateTime( "Data", "data", 15, 0/*$eo_ins_date*/ );
$edit_form->addElement( $data, false );
$note = new XoopsFormTextArea( "Note", "note", $eo_note, 10, 100, "note" );
$edit_form->addElement( $note, true );
$edit_form->addElement( new XoopsFormHidden( 'id', $id ) );
$button_tray = new XoopsFormElementTray( ' ' , ' ', 'button' );
$button_tray->addElement( new XoopsFormButton( '', 'post', "Modifica", 'submit' ) );
$edit_form->addElement( $button_tray );
$edit_form->display();
You could buffer the output and at it to a smarty tag
example:
ob_start();
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$edit_form = new XoopsThemeForm( "Edit", "edit_form", "edit.php" );
$descrizione = new XoopsFormTextArea( "Descrizione", "descrizione", $eo_descr, 10, 100, "desc" );
$edit_form->addElement( $descrizione, true );
$data = new XoopsFormDateTime( "Data", "data", 15, 0/*$eo_ins_date*/ );
$edit_form->addElement( $data, false );
$note = new XoopsFormTextArea( "Note", "note", $eo_note, 10, 100, "note" );
$edit_form->addElement( $note, true );
$edit_form->addElement( new XoopsFormHidden( 'id', $id ) );
$button_tray = new XoopsFormElementTray( ' ' , ' ', 'button' );
$button_tray->addElement( new XoopsFormButton( '', 'post', "Modifica", 'submit' ) );
$edit_form->addElement( $button_tray );
$edit_form->display();
$output = ob_get_contents();
ob_end_clean();
$xoopsTpl->assign( 'form', $output );
Or you could do it this way:
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$edit_form = new XoopsThemeForm( "Edit", "edit_form", "edit.php" );
$descrizione = new XoopsFormTextArea( "Descrizione", "descrizione", $eo_descr, 10, 100, "desc" );
$edit_form->addElement( $descrizione, true );
$data = new XoopsFormDateTime( "Data", "data", 15, 0 );
$edit_form->addElement( $data, false );
$note = new XoopsFormTextArea( "Note", "note", $eo_note, 10, 100, "note" );
$edit_form->addElement( $note, true );
$edit_form->addElement( new XoopsFormHidden( 'id', $id ) );
$button_tray = new XoopsFormElementTray( ' ' , ' ', 'button' );
$button_tray->addElement( new XoopsFormButton( '', 'post', "Modifica", 'submit' ) );
$edit_form->addElement( $button_tray );
$edit_form->assign( $xoopsTpl );
Remember When working with XoopsFormDateTime it returns an Array with two elements. The first element requires some work to be usable.
$array['date'] and $array['time]
$array['time'] will have to be converted to unixtime format and time added to it
i.e:
$date = strtotime($array['date']) + $array['time];
I will try and find out the reason why the first method does not work as it should.
Catz
Hope this helps.