
// Add our setting to these field types
fieldSettings.WEBONE_SMS_OTP += ', .webone-sms-field-otp-setting';

// Make sure our field gets populated with its saved value
jQuery(document).on("gform_load_field_settings", function(event, field, form) {

    jQuery('#webone-sms-mobile-field-id')
        .find('option')
        .remove()
    jQuery("#webone-sms-mobile-field-id").append(jQuery('<option>', {
        value: null,
        text : 'انتخاب'
    }));

    form.fields.forEach(function(item) {
        if ('phone' === item.type) {
            jQuery("#webone-sms-mobile-field-id").append(
                jQuery('<option>', {
                    value: item.id,
                    text : item.label,
                    selected: field["webone_sms_mobile_field_id"] == item.id  // TODO: refactor this
                })
            );
        }
    });
});
