Customizing news module backend with Jquery
Posted: Tue Feb 04, 2020 10:55 am
I'm having a slight problem with my news module back-end.
I've been customizing the "editarticle.tpl" so it will show/hide custom fields upon category selection.
It works fine when I create a new article in that specific category.(then the custom fields appears)
But if I want to edit the article, the custom fields are not showing.
To see the custom fields when I'm editing I have to select some other category (for example "General") and then select the previous category ( for example "CustomCategory"), then the custom fields are shown and I can edit them.
My Jquery is quite simple for this.
The custom fields are wrapped in <div id="cf_group">
And then there is this Jquery to show/hide the custom fields depending on witch category is selected.
As I said before this is working nicely when I create new article, but if I want to edit an article witch have the category with "option value = =4" (the one with all the custom fields). I first have to select another category and then the "option value = =4" category to see the custom fields.
What I want to be able to do is Just edit the articles without having to toggle between categories to edit the custom fields for the articles that are assign to the category with "option value = =4".
Can some one help me with this?
I've been customizing the "editarticle.tpl" so it will show/hide custom fields upon category selection.
It works fine when I create a new article in that specific category.(then the custom fields appears)
But if I want to edit the article, the custom fields are not showing.
To see the custom fields when I'm editing I have to select some other category (for example "General") and then select the previous category ( for example "CustomCategory"), then the custom fields are shown and I can edit them.
My Jquery is quite simple for this.
The custom fields are wrapped in <div id="cf_group">
And then there is this Jquery to show/hide the custom fields depending on witch category is selected.
Code: Select all
$('select').change(function() {
if ($(this).val() == 4) {
$('#cf_group').show();
} else {
$('#cf_group').hide();
}
});
What I want to be able to do is Just edit the articles without having to toggle between categories to edit the custom fields for the articles that are assign to the category with "option value = =4".
Can some one help me with this?