Login Retreive lost passwordRegister
Search

Forum Index / General / Setting just year for dateField

[ This topic is solved ]

  Steph 07 April 10 / 17:52  
I can see how to use dateField to prompt just for a day and month:

$form -> dateField("Aut 1 Start", "Aut1Start", '', true, "d-m")

I would like to know how to set the year so the user can't change it.

I read the comment in the dateField section of the manual which gives a method using addValue but then goes on to say it doesn't work because of a bug.

Any ideas.

Thanks,

Stephan

  Johan Wiegel (Admin) 07 April 10 / 19:15  
Changed at 07 April 10 / 19:16
A quick test learned that this code is working correct:

<?php
function FH_RUN$id$aData )
{
    
print_r$aData );
}

$oForm = new dbFormHandler("intake");
$oForm->dbInfoDB_NAME'tbl_testjw'DB_TYPE );
$oForm->dbConnectDB_HOSTDB_USERDB_PASS );

$oForm -> dateField('Created''created'nulltrue'd-m');

$d $oForm -> getValue('created');
if( !empty( 
$d ))
{
    list( 
$d$m ) = explode'-'$oForm -> getValue('created') );
    
$oForm -> addValue('created'date('Y')."-$m-$d");
}
$oForm->submitButton();
$oForm->onSaved('FH_RUN');

$oForm->flush(); 

?>


I did alter the comment, the comment was from a long time ago.

  Top


powered by PHP-GLOBE   © 2004 - 2012 FormHandler. All rights reserved.   -   Open source license