recurring_select
recurring_select copied to clipboard
How to set value via JS?
trafficstars
How I can set value via JS. I need to copy value from one field to another. There is almost none any documentation about JS part and it's not clear from source code.
I've tried to use:
# value = "{"interval":4,"until":null,"count":null,"validations":null,"rule_type":"IceCube::DailyRule","week_start":0}"
$(input).recurring_select("save", value)
but didn't have any success.
Just in case if someone need to do same here is example:
var $opt = $form.find("select[name='recurrence_rules1']>option[value='" + p.value + "']"); // I have only value but function requires option to name to set with value
$form.find("select[name='recurrence_rules2']").recurring_select("save", {str: $opt.text(), hash: $.parseJSON(p.value)});
I think it should be in documentation or there should be added some method to make it easily, so I may do something like this:
$form.find("select[name='recurrence_rules2']").recurring_select("set", p.value);