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  }?>