Skip to content

make field required on condition of other field #835

Answered by cpaschen
cpaschen asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to everyone that helped out. Using snippets from several responses (and a few others online I found), here's the final solution that worked, at least for my usecase.
[This code was placed in the 'admin_view.javascript_view_footer' area.]

//update Favorite Fiction Categories and Favorite Fiction Genres ('fiction_categories_favorite' & fiction_genres_favorite - i.e. A1,A2) required fields when Fiction ('fiction' i.e. A) option changed
jQuery('#jform_fiction').on('click', function()
{
    console.log('fiction clicked');
    var fictionStatus = jQuery("#jform_fiction0[type='radio']:checked").val();
    //console.log(jQuery("#jform_fiction0[type='radio']:checked").val());
	console.log(f…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@cpaschen
Comment options

@cpaschen
Comment options

@cpaschen
Comment options

@SimonvanDoorne
Comment options

@SimonvanDoorne
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cpaschen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants