[#7174] CB:If with Progress field

5 years 11 months ago - 5 years 11 months ago #304917 by association.aamoi
[#7174] CB:If with Progress field was created by association.aamoi
Hi,

I use CB:If in a article who test a progress field.
[cb:if cb_informations_interne_n2="0"]
	[cb:if cb_etapes_statut!="0"]
		[cb:if cb_profil_progression="100"]
			<div class="text-center">
				#Something
			</div>
		[cb:else]
			<div class="alert alert-danger">
				Your profile isn't complete ([cb_profil_progression]%).<br />
			</div>
		[/cb:else][/cb:if]
	[cb:else]
		#Something Else
	[/cb:else][/cb:if]
[/cb:if]

But when cb_informations_interne_n2 is equal to 1 or 2, i've the message "You profile isn't complete (100%)"
2 questions :
  1. Why if cb_informations_interne_n2 is > 0 we enter in and just go to the end ?
  2. Why if cb_informations_interne_n2 is > 0 and cb_profil_progression = 100, we have the message who need only appear when cb_profil_progression is != 100 ?

This problem is only present when cb_informations_interne_n2 isn't 0.

Thanks

Please Log in to join the conversation.

5 years 11 months ago #304935 by krileon
Replied by krileon on topic CB:If with Progress field
It's doing that because it's finding the first occurrence of [cb:else] and using it. In this case it's your alert. Nested IF usage was implemented to kinda support elseif when elseif didn't exist so looks like we forgot to account for that when adding else and elseif. I believe we maybe able to fix this by parsing nested [cb:if] before parsing [cb:else] and [cb:elseif]. Have added a bug ticket to review fixing in a later release.

forge.joomlapolis.com/issues/7174

The best way to avoid this is to just use elseif and else on the parent. The below should work.

[cb:if cb_informations_interne_n2="0" and cb_etapes_statut!="0" and cb_profil_progression="100"]
	<div class="text-center">
		#Something
	</div>
	[cb:elseif cb_informations_interne_n2="0" and cb_etapes_statut="0"]
		#Something Else
	[/cb:elseif]
	[cb:elseif cb_informations_interne_n2="0" and cb_etapes_statut!="0" and cb_profil_progression!="100"]
		<div class="alert alert-danger">
			Your profile isn't complete ([cb_profil_progression]%).<br />
		</div>
	[/cb:elseif]
[/cb:if]


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.

5 years 11 months ago #304950 by association.aamoi
Replied by association.aamoi on topic CB:If with Progress field
It's works.
Thanks
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.200 seconds

Facebook Twitter LinkedIn