Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-05-31 12:01:08

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Custom fields display depending on chosen category

Would be nice, if there would be option to, Turn off or turn off some custom fields to articles, or categories.
If I save article under category, Trees, then there are only custom fields, which ar turned on for Trees category.

{Edited to give a more speaking title. – Uli}

Last edited by uli (2012-06-01 12:01:33)

Offline

#2 2012-05-31 13:06:41

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Custom fields display depending on chosen category

It should be doable already with bot_wtc or some other admin side plugin (by jm?) which allows you to insert jQuery code into the Write panel, something like:

<script language="javascript" type="text/javascript">
	$(document).ready(function() {
		$("#advanced").show();
		$("select#category-1.list").change(function(){
			$("#custom-1").show();
			var value = $("select#category-1.list").val();
			if (value=="your_cat_1_value"){
				$("#custom-1").hide();
			}

		}).change();
	});
</script>

This code is absolutely untested, just copied from a local install (where I hide metas based on the section) and tried to adapt for a custom_field + category-1 relation. If it doesn’t work offhand, hide a custom_field in one/several section(s) with bot_wtc and adapt the jQuery code for your categories accordingly.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB