This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

phplee
phplee

I have a form which has a category field type dropdown. when a category is selected from a dropdown i want it to populates another field called 'credits' based on the category that was selected. the credit value is store in the category table along with the category name.

Any help would be great.

DMeganoski
DMeganoski

This is going to be something you want to do with javascript. The backend already implements jquery, if you're familiar.

Here is an thread about custom js https://octobercms.com/forum/post/how-to-add-javascript-file-to-backend-pages

something along the lines of


$(document).ready(function() {
    $('#dropdown').change(function() {
        var val = $(this).val();
        switch(val) {
            case 'first':
                $('#credits').val(2);
                break;
            case 'second':
                $('#credits').val(3);
                break;
        }
    });
});

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.