Display Address Form Field

Permalink
I have an "address" attribute called "address".

How do I go about displaying the attribute form field (to register a new user...so basically there is no user object at this point?)

I initially tried:

<?php $ad = 'akID[' . UserAttributeKey::getByHandle('address')->getAttributeKeyID() . '][value]'; 
$address = md5($ad.$timestamp.$secret);?>
<?php echo $form->label($address, t('Address') )?>
 <?php echo $form->text($address)?>


But this is just a regular text field...

Then I considered
$af = Loader::helper('form/attribute');
$af->setAttributeObject($obj); 
$af->display('address',true,true);


But then I do not know what to set the $obj to...?

 
nicolechung replied on at Permalink Reply
It looks like it's just easier to grab the attribute Registration list:

$attribs = UserAttributeKey::getRegistrationList();
                     $af = Loader::helper('form/attribute');
                     foreach($attribs as $ak) { ?> 
                           <fieldset>
                           <?php echo  $af->display($ak, $ak->isAttributeKeyRequiredOnRegister());   ?>
                           </fieldset>
                     <?php  }?>

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.