Attribute not working with text field
j7-dev opened this issue · comments
Issue
attribute
not working with text
field.
Reproduce the issue
I followed the document here
Redux::set_field( 'redux_demo', 'SECTION_ID', array(
'id' => 'field_id',
'type' => 'text',
'attributes' => array(
'type' => 'password',
'readonly' => 'readonly',
'autocomplete' => 'off',
'data-json' => array(
'example' => 'json'
)
)
) );
But It seems not working 🔽
Expected result
- override the attributes of the input field
Trace the source code
I trace code here redux-framework/redux-core/inc/fields/text/class-redux-text.php
I can't find any keyword with attributes
in class-redux-text.php
, it seems attributes
key do NOTHING in class-redux-text.php
The attributes
feature was removed last year as it was designed for something we never used. You'll have to use the field arguments instead. I'll update the docs to get rid of all that old data.
Thank for reply.
So...if I want to use
<input type="password" />
<input type="number" min="0" max="10000" />
I have to extend these fields by using my custom extension right?
Basically. Redux has a password
field, but it doesn't have min
or max.
You could easily take that field and use it to make a custom extension. Be sure to change the class name so it doesn't conflict.
Alternatively, if you're proficent in in it, you could use some custom JavaScript to add attributes to existing Redix fields. I've seen it done many times.