1
I try hack on edituser.php to make the age field be autofill in when after keyin the year of birth. i think i almost there but just can't get the 'year of birth' value,
1. I have replicate the formtext.php change it to formyear.php
Here is the code i change on my formyear.php:
Class and Function already change to 'XoopsFormYear' and
function render(){
$year = date("Y");
$year2 = "1980";
$year3 = $year-$year2;
return ".$this->getName()."' id='".$this->getName()."' size='".$this->getSize()."' maxlength='".$this->getMaxlength()."' value='".$year3."'".$this->getExtra()." />";
}
2. Add 'include_once XOOPS_ROOT_PATH."/class/xoopsform/formyear.php";' into xoopsformloader.php
3. On edituser.php i add in this code:
$year_text = new XoopsFormText(_US_YEAR, 'year', 4, 4, $xoopsUser->getVar('year', 'E'));
$age_text = new XoopsFormYear(_US_AGE, 'age', 4, 4, $xoopsUser->getVar('age', 'E'));
I set the $year2 =1998 and the result i get is 27. ^^
But how can i replace the 1998 to the year value i had enter?
you guy have any ideal to do this?