Damn u beat me to it :(

2009/7/15 Carlos Gonzalez Lavin <carloslavi...@gmail.com>

> Maybe try
> echo $form->input('Budget.id',array('type' => 'text'));
>
> 2009/7/15 geste <jim.ho...@gmail.com>
>
>
>> Hello!
>>
>> I have a table where the primary key, "id" is not autoincremented, but
>> is in fact a 6-digit "real" value.  I want to give people the ability
>> to search and filter by ID and a few other fields like "budget_name".
>> I have implemented a filter component that I found (here:
>> http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/)
>> and it all works well up to a point, but I am encountering problems
>> with the way forms helper works by default.  I'll give 2 examples:
>>
>> If I add the following form bits to my index view:
>>
>> echo $form->create('Budgets',array('url'=>array('action'=>'index')));
>> echo $form->input('id');
>> echo $form->input('budget_name');
>> echo $form->end('Search');
>>
>> both inputs appear but neither are applied by the filter when I hit
>> search.  So I got the notion to qualify each input with the model name
>> like so:
>>
>> echo $form->create('Budgets',array('url'=>array('action'=>'index')));
>> echo $form->input('Budget.id');
>> echo $form->input('Budget.budget_name');
>> echo $form->end('Search');
>>
>> Now I get 1 input for "budget_name" and searching/filtering works, but
>> the input for "id" no longer appears.  I looked at the generated HTML
>> and the input for "id" is made hidden (as in this example):
>>
>> <!--
>>  <form id="BudgetsAddForm" method="post" action="/app/budgets/index">
>> <fieldset style="display:none;"><input type="hidden" name="_method"
>> value="POST" /></fieldset>
>> <input type="hidden" name="data[Budget][id]" value="" id="BudgetId" />
>> <div class="input text"><label for="BudgetBudgetName">Budget Name</
>> label>
>> <input name="data[Budget][budget_name]" type="text" maxlength="30"
>> value="" id="BudgetBudgetName" /></div>
>> <div class="submit"><input type="submit" value="Search" /></div></
>> form>
>> -->
>>
>> So, am I right in assuming that forms helper handles "id" in this
>> conventional way (make it hidden) and is there a way to override this
>> without breaking general behavior of forms helper.  I looked at the
>> 1.2 Cookbook and I only found a "hidden" method, no "unhidden" method.
>>
>> Jim
>>
>>
>> (apologies for my formatting. I wasn't sure how Google Groups handle
>> in-line code snippets.  Automagically, I think.)
>>
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to