Skip to content

Commit

Permalink
Merge pull request tombenner#149 from themaze75/fix-hidden-input-value
Browse files Browse the repository at this point in the history
Added automatic default value to hidden input field
  • Loading branch information
cyberscribe authored Aug 6, 2016
2 parents 9597dcc + 94e21f4 commit dab8118
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/helpers/mvc_form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,14 @@ public function checkbox_input($field_name, $options=array()) {
}

public function hidden_input($field_name, $options=array()) {

$value = empty($this->object->{$field_name}) ? '' : $this->object->{$field_name};

$defaults = array(
'id' => $this->input_id($field_name),
'name' => $this->input_name($field_name),
'type' => 'hidden'
'type' => 'hidden',
'value' => $value
);
$options = array_merge($defaults, $options);
$attributes_html = self::attributes_html($options, 'input');
Expand Down

0 comments on commit dab8118

Please sign in to comment.