@@ -28,7 +28,6 @@ Options are passed to fields using *input_html* parameter as *data* attributes:
2828 + ** not_blank** : check if a field is not blank
2929- ** data-eq** : check if a field has a specific value
3030- ** data-not** : check if a field hasn't a specific value
31- - ** data-function** : check the return value of a custom function
3231- ** data-target** : target css selector
3332- ** data-action** : the action to trigger, values:
3433 + ** hide** : hides elements
@@ -37,9 +36,8 @@ Options are passed to fields using *input_html* parameter as *data* attributes:
3736 + ** addClass** : adds classes
3837 + ** setValue** : set a value
3938 + ** callback** : call a function
40- - ** data-value** : value to set
41- - ** data-callback** : custom function for setting a value
42- - ** data-arg** : argument passed to the custom set function
39+ - ** data-function** : check the return value of a custom function
40+ - ** data-arg** : argument passed to the custom set function (as array of strings)
4341
4442## Examples of dynamic fields
4543
6058
6159` f.input :published, input_html: { data: { if: 'checked', action: 'addClass first second third', target: '.grp1' } } `
6260
63- - Set another field value if a string field is blank (with alternative syntax for data attributes) :
61+ - Set another field value if a string field is blank:
6462
65- ` f.input :title, input_html: { ' data-if' : 'blank', 'data- action' : 'setValue', 'data- target' : '#article_position', 'data-value': '10' } `
63+ ` f.input :title, input_html: { data: { if : 'blank', action: 'setValue 10 ', target: '#article_position' } } `
6664
67- - Use a custom function for conditional check (* title_not_empty()* must be available on global scope):
65+ - Use a custom function for conditional check (* title_not_empty()* must be available on global scope) (with alternative syntax for data attributes) :
6866
6967` f.input :title, input_html: { 'data-function': 'title_empty', 'data-action': 'slide', 'data-target': '#article_description_input' } `
7068
@@ -76,7 +74,7 @@ function title_empty( el ) {
7674
7775- Call a callback function as action:
7876
79- ` f.input :published, input_html: { ' data-if' : 'checked', 'data- action' : 'callback', 'data-callback': ' set_title', 'data- args' : '["[unpublished] "]' } `
77+ ` f.input :published, input_html: { data: { if : 'checked', action: 'callback set_title', args: '["Unpublished ! "]' } } `
8078
8179``` js
8280function set_title ( args ) {
0 commit comments