[Solar-talk] Forms, User roles and access

Kilbride, James P. James.Kilbride at gd-ais.com
Fri May 2 11:02:58 CDT 2008


I disagree. Grouping is not a design function always. In this case it's saying these elements of the form are a group of similar ones. I know that in the controller because I am creating them as a group. The view can do what it wants with the group but I, as the controller, want to say that they are a group of elements that are logically bound together.

James Kilbride 

-----Original Message-----
From: solar-talk-bounces at lists.solarphp.com [mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Benjamin Kaineder
Sent: Friday, May 02, 2008 11:57 AM
To: solar-talk at lists.solarphp.com
Subject: Re: [Solar-talk] Forms, User roles and access

I had the same problem. As grouping is seen as a design function, it has to be used in the view, not in the controller. So you use setElements() on the Solar_Form in your controller and something like that in the view, utilizing the form-helper:

<?php
echo '<form action="anmeldung.php" method="post"
enctype="multipart/form-data">';

echo $this->form()
        ->setStatus($this->formanm->getStatus())
        //->addFeedback($this->formanm->feedback)
        ->fetch(false);

echo '<h2>Termin für Qualifikation</h2>';

echo $this->form()
        ->addElement($this->formanm->elements['turnier'])
        ->addElement($this->formanm->elements['startzeit'])
        ->fetch(false);

echo '<h2>Spieler</h2>';

echo $this->form()
        ->beginGroup($this->getText('LABEL_ANM_NAME'))
        ->addElement($this->formanm->elements['nachname'])
        ->addElement($this->formanm->elements['vorname'])
        ->endGroup()
        ->addElement($this->formanm->elements['strasse'])
        ->beginGroup($this->getText('LABEL_ANM_ORT'))
        ->addElement($this->formanm->elements['plz'])
        ->addElement($this->formanm->elements['ort'])
        ->endGroup()
        ->addElement($this->formanm->elements['telefon'])
        ->addElement($this->formanm->elements['email'])
        ->fetch(false);

echo $this->form()
        ->addElement($this->formanm->elements['heimatclub'])
        ->addElement($this->formanm->elements['handicap'])
        ->fetch(false);

echo $this->form()
        ->addElement($this->formanm->elements['process'])
        ->fetch(false);

echo '</form>';
?>


Not very elegant in any way but that's the only way I got it to work with grouping and html in between the fields.
I'd say this definitely is a topic worth improving :-)

Ben


Kilbride, James P. schrieb:
> Btw, I went back to this and realized that this is talking about the 
> Solar_View_Helper_Form not Solar_Form.
>
> So I add the elements to the Solar_Form in my controller. I am not 
> working with a Solar_View_Helper_Form in the controller. doing the 
> setElements and such. But beginGroup doesn't seem to exist on 
> Solar_Form so how do you begin/end the group if using the Solar_Form class?
>
> This is what I'm trying to do:
>
> 		$this->matrixForm = Solar::factory('Solar_Form');
>
> 		$this->matrixForm->beginGroup('Verification Equipment');
> 		$equipmentSet = $this->program->equipmentRelation;
> 		$equipmentList = $currMatrix->equipmentRelations;
> 		$verificationEquipment =
> Solar::factory('ProcedureMatrix_Models_VerificationEquipment');
> 		foreach ($equipmentSet as $equipment) {
> 			$currentValue = '';
> 			foreach ($equipmentList as $linkObject) {
> 				if($linkObject->equipment_id ==
> $equipment->equipment_id) {
> 					$currentValue =
> $linkObject->equipment_usage;
> 				}
> 			}
> 	
> $this->matrixForm->setElement('equipment'.$equipment->equipment_id,arr
> ay
> (
> 	  			'type'  	=> 'select',
> 	  			'label' 	=>
> $equipment->equipment->equipment_name.':',
> 				'options'	=>
> $verificationEquipment->usageOptions(),		
> 				'value'		=> $currentValue,
> 			));
> 		}
> 		$this->matrixForm->endGroup();
>
> in my view I'm just doing:
>
> <?php echo $this->form($this->matrixForm); ?>
>
> James Kilbride
> -----Original Message-----
> From: solar-talk-bounces at lists.solarphp.com
> [mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Kilbride, 
> James P.
> Sent: Monday, March 24, 2008 12:38 PM
> To: solar at 3hex.com; solar-talk at lists.solarphp.com
> Subject: RE: [Solar-talk] Forms, User roles and access
>
> So it is in there! When was that added? Because I know we looked for 
> something like this at one point and i think we discussed it then.
> Didn't realize it had come back into the trunk.
>
> James Kilbride
>
> -----Original Message-----
> From: solar-talk-bounces at lists.solarphp.com
> [mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Jeff 
> Surgeson
> Sent: Monday, March 24, 2008 12:34 PM
> To: solar-talk at lists.solarphp.com
> Subject: Re: [Solar-talk] Forms, User roles and access
>
> Hi  James
>
>   
>> Hehe, good questions. Solar_Form is not highly customizable in it's 
>> structure. Though I had a thought. Paul, what about adding the 
>> capability in Solar_Form to 'group' things together. Everything in a 
>> given groups would be displayed horizontally rather than 
>> vertically(if
>>     
>
> beginGroup() and endGroup() will group for example 3 buttons together 
> and display them horizontally as apposed to default vertically.
>
> echo $this->form()
> 	->auto($this->forms['edit'])
>         ->beginGroup()
>         ->addProcessGroup(array(
>         	'save',
>                 'cancel',
>                 'delete' => array('attribs' => $attribs)
>               ))
>         ->endGroup()
>         ->fetch();
>
>   
>> + Solar_Form:
>>    How can I customize the way the form is build up
>>    concerning the design? E.g.: I would like to set some
>>    fields next to each other instead of below.
>>
>> Tino
>>     
>
> --
> ...........::::::...........
> Jeff Surgeson / South Africa
> _______________________________________________
> Solar-talk mailing list
> Solar-talk at lists.solarphp.com
> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>
> _______________________________________________
> Solar-talk mailing list
> Solar-talk at lists.solarphp.com
> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>
> _______________________________________________
> Solar-talk mailing list
> Solar-talk at lists.solarphp.com
> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>
>   
_______________________________________________
Solar-talk mailing list
Solar-talk at lists.solarphp.com
http://mailman-mail3.webfaction.com/listinfo/solar-talk



More information about the Solar-talk mailing list