#6033: Form Helper input() truncating input tag value
-------------------------+--------------------------------------------------
Reporter: AZWebDev | Owner:
Type: Bug | Status: new
Priority: Medium | Milestone: 1.2.x.x
Component: General | Version: 1.2 Final
Severity: Normal | Resolution:
Keywords: | Php_version: n/a
Cake_version: 1.2.8004 |
-------------------------+--------------------------------------------------
Old description:
> In a form using the Form helper, I'm simply passing $this->data back and
> forth. The user fills out a generic form (not using a Model), clicks the
> submit button, logic in the controller sees some missing fields and
> bypasses the if( empty( $this->data ) ) condition and brings the user
> back to the form. The form, on the second time around, truncates any
> field values that are put into the "value" attributes of the "input" tags
> in HTML.
>
> In the view (index.ctp):
> <?= $form->create( null, array( "url" => "/contact" ) ?>
> <?= $form->input( 'fullname', array( 'label' => false, 'div' => false ) )
> ?>
> ...
>
> Whether or not the array( 'label' => false, 'div' => false ) is in the
> parameter list, the same behavior is exhibited.
>
> If you output the $this->data array, it looks perfectly fine:
>
> Array
> (
> [fullname] => bob Smith
> [address1] =>
> [address2] =>
> [city] =>
> [state] =>
> [zipcode] =>
> [phone] =>
> [email] => asdfasdf
> [comments] =>
> )
>
> If you purposefully add the 'value' field to the "options" array:
>
> <?= $form->input( 'fullname', array( 'label' => false, 'div' => false,
> 'value' => $this->data['fullname'] )) ?>
>
> ...the value is set correctly and the behavior is as expected. Without
> the 'value' => $this->data['fullname'] in the second parameter array,
> only the first character is shown in the field on the form the second
> time around to this view.
>
> Controller is attached. View is attached.
New description:
In a form using the Form helper, I'm simply passing $this->data back and
forth. The user fills out a generic form (not using a Model), clicks the
submit button, logic in the controller sees some missing fields and
bypasses the if( empty( $this->data ) ) condition and brings the user back
to the form. The form, on the second time around, truncates any field
values that are put into the "value" attributes of the "input" tags in
HTML.
[[BR]][[BR]]
In the view (index.ctp):
{{{
<?= $form->create( null, array( "url" => "/contact" ) ?>
<?= $form->input( 'fullname', array( 'label' => false, 'div' => false ) )
?>
...
}}}
Whether or not the array( 'label' => false, 'div' => false ) is in the
parameter list, the same behavior is exhibited.
[[BR]]
[[BR]]
If you output the $this->data array, it looks perfectly fine:
{{{
Array
(
[fullname] => bob Smith
[address1] =>
[address2] =>
[city] =>
[state] =>
[zipcode] =>
[phone] =>
[email] => asdfasdf
[comments] =>
)
}}}
If you purposefully add the 'value' field to the "options" array:
{{{
<?= $form->input( 'fullname', array( 'label' => false, 'div' => false,
'value' => $this->data['fullname'] )) ?>
}}}
...the value is set correctly and the behavior is as expected. Without the
'value' => $this->data['fullname'] in the second parameter array, only the
first character is shown in the field on the form the second time around
to this view.
[[BR]][[BR]]
Controller is attached. View is attached.
Comment (by mark_story):
fixed formatting
--
Ticket URL: <https://trac.cakephp.org/ticket/6033#comment:1>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---