cotonti.com : Custom extrafield bug + cot_inputbox https://www.cotonti.com Последние сообщения в теме Cotonti en Mon, 13 Oct 2025 19:02:14 -0000 Trustmaster This is not a bug, this is how it is supposed to work. It is a new feature that you are missing: custom empty options and default options for selects. It should be implemented explicitly in cot_selectbox() function, or you could implement it as your own function.

]]>
сб, 16 мар 2013 18:06:10 -0000
Eugene Yes, and let me clarify a problem, cause you can advise a solution.

As you know there's no placeholder for select. And there several ways to emulate it. Simple html-way is to include empty-value-option into select before all other selects. So, there's line for custom select in RC:

$R['input_select_rpageoptik'] = '<select required name="{$name}"{$attrs}>'.
	'<option label="Jede Optik" value="" selected="selected"  >Jede Optik</option>'.
	'{$options}</select>{$error}';

But in cot_selectbox selected is already build-in and always assign to one of assigned options. This way I will have 2 selected options. Also, as empty-value-option is not in array of assigned values I will get error (field_notinarray_..) from extrafield_import...

You may say, "so, add empty value by $add_empty = true".  But it is not possible, cause it also not custom in cot_build_extrafields.

Moreover, there is no way to create custom $R['code_option_empty'] for some custom selectbox.... it is "---" (default) for all empty options in selects...

]]>
сб, 16 мар 2013 13:09:54 -0000
Trustmaster For selectbox you can only use custom HTML for the select itself but not options.

]]>
сб, 16 мар 2013 07:53:43 -0000
Eugene it would be awesome!

btw, i guess the same mechanism is in cot_selectbox...

]]>
пт, 15 мар 2013 22:03:57 -0000
Trustmaster Priorities are actually fine. It's a small bug in cot_inputbox() function which doesn't let you set custom_rc. I'll fix it shortly.

]]>
пт, 15 мар 2013 18:48:23 -0000
Eugene 2 option is higher priority for the sake of clarity in administration/tuning...

As i understand we cannot change last argument of function cot_inputbox (and selectbox) for backward compatibility. Right?
So, there just a need to assign some RC_name to the html mask from admin area and pass it to functions... But where to store this name? Code is stored right in DB...

I'm sure, there's another option of checking things right in cot_inputbox....

Добавлено 2 дня спустя:

Trust, do you want me to add this to GitHub?

]]>
пн, 11 мар 2013 15:19:49 -0000
Trustmaster Any ideas on how to set priorities between these 2?

]]>
пн, 11 мар 2013 12:49:01 -0000
Eugene When updating/customizing extrafield html code in admin area - it goes to DB (cot_extra_fields) as "field_html".
Later this content is used to build inputbox (extrafields.php -> function cot_build_extrafields). On line #36 this html goes to cot_inputbox while it is expecting just a custom name of $rc - NOT the html code itself (forms.php #67-69)
So, later it is just replaced with 'input_default'.

Exaple of the code I play with in admin area of extrafields for Pages is
 

<input required="required"  type="text" name="{$name}" value="{$value}" {$attrs} />

or

<input type="number" name="{$name}" value="{$value}" {$attrs} />


We need clarity on customization proccess. We need to be able to both:

  1. Create custom $R[input_{$type}_{$rc_name}] in our plugins
  2. Customize html mask in admin area (this is very beneficial for newbies)
]]>
пн, 11 мар 2013 10:59:42 -0000