Need Help about Form->control("")


If I specify a character string containing underbar in Form-> control (""), the character string after underbar will not be displayed as a label.
The same result will be obtained even if it is “\ _”.
Could you tell me how to display the character string after underbar ?

code> Form-> control (“xxxx_yyyy”)
result> Xxxx

code> Form-> control (“xxxx\_yyyy”)
result> Xxxx\

Desired results>xxxx_yyyy


Have you tried to use escape ?

echo $this->Form->control(‘name’, [


Thank you for your reply.
I try following 3 code,

  1. echo $this->Form->control(“xxx_yyy”);
    Xxx Yyy
  2. echo $this->Form->control(“xxx_yyy”,[‘escape’ => false]);
    Xxx Yyy (same as 1)
  3. echo $this->Form->control(“xxx_id”,[‘escape’ => false]);

case 1,2 : underbar -> white space
case 3 : when string after underbar is “id”, underbar + “id” is not displyed.
This is the first case I asked.

Is there a way(by Form->control() ) to display the specified character string as it is?


I’m not sure at all but maybe the method $this->Form->control() is the problem. Have you tried to use a specific method for a type of field like echo $this->Form->text() ?


Thanks for your reply.
As a workaround, I temporarily decided to get through with the following code.

[workaround code]
echo $this->Form->label(“xxxx_id”,array(‘label’ => ‘xxxx_id’));

echo $this->Form->text(“xxxx_id”);

if I specify [xxxx_id] for Form-> control (), it will be interpreted as the ID of [xxxx] table, and [listbox] will be displayed instead of [textbox].