Skip to content
Discussion options

You must be logged in to vote

i figured this out, leaving this here if anyone ever needs it.

to use with select_2, you have to put quotes around the values you are checking for.
This works for me:

crud.field('landing_page_id').onChange(function(field) {

switch(field.value) {
    case '1': // <---- here, it should be checked against string, not integer.
        source = "/images/landing_page/brand.png";
        break;
    case '2': // <---- here, it should be checked against string, not integer.
        source = "/images/landing_page/c_1.png";
        break;
    default:
        source = "/images/landing_page/empty.png";
}


$('img[id="lander-thumb"]').attr('src', source);
}).change();

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pxpm
Comment options

pxpm Feb 9, 2023
Maintainer

@pxpm
Comment options

pxpm Feb 9, 2023
Maintainer

Answer selected by pxpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants