1
jilong
how to autofill the age?
  • 2007/7/20 8:04

  • jilong

  • Just popping in

  • Posts: 61

  • Since: 2007/1/10


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 
"<input type='text' name='".$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'44$xoopsUser->getVar('year''E'));

$age_text = new XoopsFormYear(_US_AGE'age'44$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?

Login

Who's Online

220 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 220


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits