cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[2.0.0] Phalcon\Tag::select() can not work with 'using' option in Volt

Open fukuda-s opened this issue 11 years ago • 8 comments

Following code in Volt can not work using 2.0.0. (with 1.3.4 it works)

{{ select('productId', products, 'using': ['id', 'name'], 'useEmpty': true, 'emptyText': 'Please, choose one...', 'emptyValue': '@') }}

http://docs.phalconphp.com/en/latest/reference/tags.html#making-select-boxes

Thanks,

fukuda-s avatar Apr 17 '15 06:04 fukuda-s

Are you getting an error or something?

andresgutierrez avatar Apr 19 '15 22:04 andresgutierrez

I can't find any massage on error log (Even the setting of error_reporting = E_ALL on php.ini).

Actually, the select form is shown on 2.0.0, however the second and third options (the value of "products" and "'using': ['id', 'name']" as following example code) don't work, then the select form options has empty names and values.

{{ select('productId', products, 'using': ['id', 'name'], 'useEmpty': true, 'emptyText': 'Please, choose one...', 'emptyValue': '@') }}

fukuda-s avatar Apr 20 '15 03:04 fukuda-s

If use in model 'colums' \Model\Categories::find(array( 'columns' => array( 'id', 'name', 'url_name', ), 'order' => 'name ASC',)); not work. select form options has empty names and values.

if use with out 'colums' \Model\Categories::find(array('order' => 'name ASC')); - all work correct

FlexIDK avatar Apr 29 '15 13:04 FlexIDK

I have the same issue, but in my case, my products entity is a doctrine entity.

pablomoreno61 avatar May 15 '15 09:05 pablomoreno61

Hello I am experiencing the same issue, posted my experience with it at this Thread -- #10284 No errors being reported - Just blank select being formed.

GiTnEd avatar May 29 '15 11:05 GiTnEd

I'm not able to reproduce this, could you please try again using latest Phalcon 2 (2.0.3) or submit a script that allow us to see the problem?

andresgutierrez avatar Jun 17 '15 20:06 andresgutierrez

Thank you for your comment. I find another cause of this problem of code on controller.

If i used following code on controller, the problem does not occur.

$products = Products::find();

However, if I use "columns" option on find() as follows, phalcon v2.0.3 returns blank select form.

$products = Products::find(array(
  'columns' => array(
    'id', 'name'
  )
));

fukuda-s avatar Jun 18 '15 02:06 fukuda-s

Fixed in Phalcon 2.0.4

andresgutierrez avatar Jul 17 '15 01:07 andresgutierrez