Skip to content
Snippets Groups Projects
Commit 609f32fe authored by Matthieu Guffroy's avatar Matthieu Guffroy
Browse files

use label for form

parent c2955914
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ class BoolField extends Field ...@@ -6,7 +6,7 @@ class BoolField extends Field
public function html($form) { public function html($form) {
if($this->value) { $checked="checked"; } else { $checked = false; } if($this->value) { $checked="checked"; } else { $checked = false; }
$html = '<div class="checkbox"> <label> <input type="checkbox" name="'.$this->name.'" '.$checked.'>'.ucfirst($this->name).'</label> </div>'; $html = '<div class="checkbox"> <label> <input type="checkbox" name="'.$this->name.'" '.$checked.'>'.$this->label.'</label> </div>';
return $html; return $html;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
public function html() { public function html() {
$html = '<div class = "form-group"> $html = '<div class = "form-group">
<label for = "form'.$this->name.'"> <label for = "form'.$this->name.'">
<input type = "date" name = "'.$this->name.'" value ="'.$this->value.'"> '.ucfirst($this->name).' <input type = "date" name = "'.$this->name.'" value ="'.$this->value.'"> '.$this->label.'
</label> </label>
</div>'; </div>';
return $html; return $html;
......
...@@ -22,7 +22,7 @@ class Field { ...@@ -22,7 +22,7 @@ class Field {
if($this->primary && $form->action == "Modifier") { $disabled = "disabled"; } if($this->primary && $form->action == "Modifier") { $disabled = "disabled"; }
return '<div class="form-group"> return '<div class="form-group">
<label for="form'.$this->name.'">'.ucfirst($this->name).'</label> <label for="form'.$this->name.'">'.$this->label.'</label>
<input type="text" class="form-control" name="'.$this->name.'" value="'.$this->value.'" '.$disabled.'> <input type="text" class="form-control" name="'.$this->name.'" value="'.$this->value.'" '.$disabled.'>
</div>'; </div>';
} }
......
...@@ -22,7 +22,7 @@ class ForeignField { ...@@ -22,7 +22,7 @@ class ForeignField {
if($this->primary && $form->action == "Modifier") { $disabled = "disabled"; } if($this->primary && $form->action == "Modifier") { $disabled = "disabled"; }
$html = '<div class="form-group"> $html = '<div class="form-group">
<label for="form'.$this->name.'">'.ucfirst($this->name).'</label> <label for="form'.$this->name.'">'.$this->label.'</label>
<select class="form-control" name="'.$this->name.'">'; <select class="form-control" name="'.$this->name.'">';
foreach ($this->choices as $value) { foreach ($this->choices as $value) {
if($this->value == $value->{$value->_primaryAttr}()) { $selected = "selected"; } else { $selected = ""; } if($this->value == $value->{$value->_primaryAttr}()) { $selected = "selected"; } else { $selected = ""; }
......
...@@ -5,7 +5,7 @@ class PhoneField extends Field ...@@ -5,7 +5,7 @@ class PhoneField extends Field
public function html() { public function html() {
$html = '<div class = "form-group"> $html = '<div class = "form-group">
<label for = "form'.$this->name.'"> <label for = "form'.$this->name.'">
<input type = "tel" name = "'.$this->name.'" value ="'.$this->value.'"> '.ucfirst($this->name).' <input type = "tel" name = "'.$this->name.'" value ="'.$this->value.'"> '.$this->label.'
</label> </label>
</div>'; </div>';
return $html; return $html;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment