[#5539] CBsubs subscription price depending on a field

8 years 4 weeks ago #279670 by krileon
Ok, was able to confirm the issue. jQuery Validate it self is skipping the input if 1 of its options (in case of multicheckbox or radio) is hidden. Should just skip that one option instead of ignoring the entire input.

I don't have a fix to suggest at this time and my entire focus is on working on our new Joomlapolis site. I've added a bug ticket to investigate further at a later time. Seams the error placement issue was only part 1 of the bug. This issue seams to come directly from jQuery Validate so unsure how to approach at this time. Likely a custom validation rule needs to be added to CBSubs it self so jQuery Validate can better handle the plan selector input.

forge.joomlapolis.com/issues/5874


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.

8 years 4 weeks ago #279673 by activha
This is an old problem...
For now we have a special javascript to force selection of plans depending upon first two questions, so I won't change it for now :-)

Let me know when fixed because it brings other problem for upgrading or changing plans that we had earlier

Please Log in to join the conversation.

8 years 4 weeks ago #279683 by krileon
It's a problem directly rooted in jQuery Validate. Only solution I can think of at this time is writing a custom validation rule specifically for CBSubs plans selection to account for hidden options, but will be reviewing it further when time permits to see if it can be fixed in our cbvalidate jQuery plugin.


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.

7 years 11 months ago #281496 by activha

Only solution I can think of at this time is writing a custom validation rule specifically for CBSubs plans selection to account for hidden options, but will be reviewing it further when time permits to see if it can be fixed in our cbvalidate jQuery plugin.


Hi
Did you move on this bug ?
Could you suggest a custom validation rule to account for hidden plans ? if none is selected

When trying to register lots or our users miss the click on the radio button and they are brought back to the registration screen without understanding really what to do

Thanks for helping on this

Please Log in to join the conversation.

7 years 11 months ago #281497 by activha
We changed fields from drop down to radio and it seems that our validation code does not work any longer

Mind to have a look at activ-ha.com/inscription
$('#cbf6425').on( 'change', function() {
	switch ($(this).val()) {
		case 'Professionnel':
			$('#cbf6472').change(function(){
				switch ($(this).val()) {
					case '1':
						$('input[id=cbpplan1]:radio').val(['1']);
					break;	
					case '0' :
						$('#cbf6474').change(function() {
							switch ($(this).val()) {
								case 'N1':
									$('input[id=cbpplan6]:radio').val(['6']);
								break;
								case 'N2':
									$('input[id=cbpplan39]:radio').val(['39']);
								break;			
								case 'N3':
									$('input[id=cbpplan41]:radio').val(['41']);
								break;			
								case 'N4':
									$('input[id=cbpplan40]:radio').val(['40']);
								break;
								case 'N5':
									$('input[id=cbpplan7]:radio').val(['7']);
								break;	
							}
						});			
				}
			});
		break;
		case 'Particulier':
			$('input[id=cbpplan10]:radio').val(['10']);
			break;		
		break;	
	}
});

Please Log in to join the conversation.

7 years 11 months ago #281502 by krileon

Did you move on this bug ?

No, the bug has not been fixed yet.

Could you suggest a custom validation rule to account for hidden plans ? if none is selected

No, it's not about making a custom validation rule. The selector responsible for activating the validation rule completely skips the input due to 1 radio of the input being hidden. This is all rooted in jQuery Validate it self. It's not a simple fix and will probably have to rewrite how it finds inputs.

We changed fields from drop down to radio and it seems that our validation code does not work any longer

I can't help you with custom code. That's just a jQuery change event and not an actual validation rule. Having a change event depending on another inside of a switch case doesn't make much sense. You should have the below for example.

$('#cbf6425,#cbf6472,#cbf6474').on( 'change', function() {
	switch ($('#cbf6425').val()) {
		case 'Professionnel':
			switch ($('#cbf6472').val()) {
				case '1':
					$('input[id=cbpplan1]:radio').val(['1']);
				break;	
				case '0' :
					switch ($('#cbf6474').val()) {
						case 'N1':
							$('input[id=cbpplan6]:radio').val(['6']);
						break;
						case 'N2':
							$('input[id=cbpplan39]:radio').val(['39']);
						break;			
						case 'N3':
							$('input[id=cbpplan41]:radio').val(['41']);
						break;			
						case 'N4':
							$('input[id=cbpplan40]:radio').val(['40']);
						break;
						case 'N5':
							$('input[id=cbpplan7]:radio').val(['7']);
						break;	
					}
			}
		break;
		case 'Particulier':
			$('input[id=cbpplan10]:radio').val(['10']);
			break;		
		break;	
	}
});

In short the change event is bound to all 3 fields. Your switch cases then directly pull values from those inputs as needed.


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.

Moderators: beatnantkrileon
Time to create page: 0.258 seconds

Facebook Twitter LinkedIn