Les contrôles

Introduction

Les contrôles RadioButton permettent d'afficher des champs des élements de selection unique.

Résultat


Ajout directement dans la vue

fichier .tpl

<label>Choix 1 <label>
{{GetControl(RadioButton, rbChoice,{Value=1, Name=Choices})}}
<label>Choix 2 <label>
{{GetControl(RadioButton, rbChoice,{Value=2, Name=Choices})}}

Ajout depuis un controlleur

fichier .php

$rbChoice = new RadioButton("rbChoice");
$rbChoice->Value = 1;
$rbChoice->Name = "Choices";
$view->AddElement($rbChoice);
$rbChoiceTwo = new RadioButton("rbChoiceTwo");
$rbChoiceTwo->Value = 1;
$rbChoiceTwo->Name = "Choices";
$view->AddElement($rbChoiceTwo);

Fichier .tpl

<label>Choix 1 <label>
{{rbChoice}}
<label>Choix 2 <label>
{{rbChoiceTwo}}

Ajout dans un formulaire

Dans le fichier .php

$this->form->Add(array("Type" => "RadioButton", "Id" => "Choice", "Name" => "Choices", "Value" => "1", ));
$this->form->Add(array("Type" => "RadioButton", "Id" => "ChoiceTwo", "Name" => "Choices", "Value" => "2", ));

Dans le fichier .tpl

<label>Choix 1 <label>
{{form->Render(Choice)}}
<label>Choix 2 <label>
{{form->Render(ChoiceTwo)}}