Auto Action to disable HTML form options

2 years 3 months ago #328142 by krileon
Replied by krileon on topic Auto Action to disable HTML form options
I don't understand why this needs to be in an individual users userlist row. I'm at a complete loss as to what you're trying to accomplish with this. You said it needed to be stored this would allow it to be stored, but you also want it rendered in a users userlist row?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 years 3 months ago - 2 years 2 months ago #328143 by galanopd
Replied by galanopd on topic Auto Action to disable HTML form options
I don't know how to explain more analytically...

The Select list (emailoptions) needs to be available to the visitor (not a registered user) in order to select how to communicate with the user, either in a free or a paid way (e.g. paypal). Therefore this information doesn't have to be stored, we don't really care about the visitor. He will make his choice on the UserList and done.

The radio field (emailoptions_type) is the choice of the user (registered user) whether he accepts to receive email from visitors or not.

I hope it s more clear now

Please Log in to join the conversation.

2 years 3 months ago #328144 by krileon
Replied by krileon on topic Auto Action to disable HTML form options
Ok, then they're 2 entirely different things. Use normal fields as instructed above for the emailoptions_type behavior. Use plain ol' HTML in an auto action for emailoptions behavior. I don't know what else to suggest, sorry.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 years 3 months ago - 2 years 2 months ago #328145 by galanopd
Replied by galanopd on topic Auto Action to disable HTML form options
It is ok Kyle, one question

I will use CBradiofield for user option and HTMLcustomfield for visitor select options. Their connection will be established using
$(function () {

	$('.selectEmailOptionsTypeInput').on('change', function () {
		const select = $(this).closest('.selectEmailOptionsType').siblings('.selectEmailOptions');

		if ($(this).val() === 'days') {
			select.removeClass('hidden');
			select.find('option.selectEmailOptionDays').removeClass('hidden').prop('disabled', false);
			select.find('option.selectEmailOptionHours').addClass('hidden').prop('disabled', true);
		} else if ($(this).val() === 'hours') {
			select.removeClass('hidden');
			select.find('option.selectEmailOptionHours').removeClass('hidden').prop('disabled', false);
			select.find('option.selectEmailOptionDays').addClass('hidden').prop('disabled', true);
		} else if ($(this).val() === 'noemail') {
			select.addClass('hidden');
		}
	}).trigger('change');
});

Do you think it will be wise to use something like the below in order to add the classes missing from the normal CBradiofield in order to make it work?
	$('#cbfr_336').addClass('selectEmailOptionsType');
	$('#cb_emailoptions_type_cbf0').addClass('selectEmailOptionsTypeInput');
	$('#cb_emailoptions_type_cbf1').addClass('selectEmailOptionsTypeInput');
	$('#cb_emailoptions_type_cbf2').addClass('selectEmailOptionsTypeInput');

Edit1: I have managed to use conditional on "noemail" value and the custom HTMLselectfield (emailoptions) becomes hidden based on the selection of the normal CBradiofield (emailoptions_type).
I haven't managed so far to make JQueryAutoAction to work. I have tried calling the ids instead of classes with no luck
$( '#cb_emailoptions_type_cbf0, #cb_emailoptions_type_cbf1, #cb_emailoptions_type_cbf2').on('change', function () {
		const select = $( this ).closest( '#cbfv_336' ).siblings( '.selectEmailOptions' );

I have also tried to add classes to CBradiofieldoptions like
var div = $('#cbfr_336'); 
var cbf0 = $('#cb_emailoptions_type_cbf0'); 
var cbf1 = $('#cb_emailoptions_type_cbf1'); 
var cbf2 = $('#cb_emailoptions_type_cbf2'); 
div.className += " selectEmailOptionsType";
cbf0.className += " selectEmailOptionsTypeInput";
cbf1.className += " selectEmailOptionsTypeInput";
cbf2.className += " selectEmailOptionsTypeInput";
or
$('[name="cb_emailoptions_type"]').click(function () {
		$('#cbfv_336').addClass('selectEmailOptionsType');
		$('#cb_emailoptions_type_cbf0').addClass('selectEmailOptionsTypeInput');
		$('#cb_emailoptions_type_cbf1').addClass('selectEmailOptionsTypeInput');
		$('#cb_emailoptions_type_cbf2').addClass('selectEmailOptionsTypeInput');
	});

Any help would be appreciated...

Please Log in to join the conversation.

2 years 2 months ago #328156 by krileon
Replied by krileon on topic Auto Action to disable HTML form options

I will use CBradiofield for user option and HTMLcustomfield for visitor select options. Their connection will be established using

Remove the jQuery ready statement surrounding the jQuery when adding that to CB Auto Actions or that won't work.

Do you think it will be wise to use something like the below in order to add the classes missing from the normal CBradiofield in order to make it work?

You shouldn't be using this at all for profile edit. Let CB Conditional deal with showing/hiding things. You're adding custom coding and extra things to maintain that you don't need.

I haven't managed so far to make JQueryAutoAction to work. I have tried calling the ids instead of classes with no luck

The jQuery and HTML I provided below is EXCLUSIVELY for the userlist output you were original asking for. It's not going to work in profile edit. Use CB Conditional for profile edit behaviors.

www.joomlapolis.com/forum/255-developer-members-support/244653-auto-action-to-disable-html-form-options?start=0#328075


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: galanopd

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #328165 by galanopd
Replied by galanopd on topic Auto Action to disable HTML form options
I think I made it work!

Thanks
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.235 seconds

Facebook Twitter LinkedIn