SHOW SECTION_START woes

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Pomegranate
Posts: 33
Joined: Sun Jul 16, 2017 11:53 pm
Location: Mongolia, Ulaanbaatar

SHOW SECTION_START woes

Post by Pomegranate »

Hello and good everyone,

I'm using SHOW SECTION_START to filter between styles on a custom query inside a form.

Here is the code

Code: Select all

<div class="course-wrapper">
<<IF UserModule.ValueTest = 'Yes' THEN SHOW SECTION_START>>
		<a href="#/" onclick="AwareApp.startProcess2('ModuleViewTrainee','UserModule',{ID},'new_tab')"><div class="course-name">{sc_Name}</div></a>
		<a href="#/" onclick="AwareApp.startProcess2('ModuleViewTrainee','UserModule',{ID},'new_tab')"><div class="course-image">{sc_Image}</div></a>
		<a href="#/" onclick="AwareApp.startProcess2('ModuleViewTrainee','UserModule',{ID},'new_tab')">
		<div class="course-content">
			<div class="course-description">НЭВТРЭХ</div>
		</div>
	</a>
<<SECTION_END>>
<<IF UserModule.ValueTest = 'No' THEN SHOW SECTION_START>>
		<div class="course-name">{sc_Name}</div>
		<div class="course-image2">{sc_Image}</div>
		<div class="course-content">
			<div class="course-description">{sc_EffectiveDate}</div>
		</div>
<<SECTION_END>>
</div>
I can't seem to make it do what I want, the results are always empty, nothing shows up,

Is there something wrong with the code, is it syntax error, it got me stumped, I would really appreciate it if you can have a look and tell me what I did wrong.

Thanks for your time :).
Pomegranate
Posts: 33
Joined: Sun Jul 16, 2017 11:53 pm
Location: Mongolia, Ulaanbaatar

Re: SHOW SECTION_START woes

Post by Pomegranate »

Actually, I went another way,

I added a class to the a links like so

Code: Select all

<a class="{ValueTest}" href="#/" onclick="AwareApp.startProcess2('LessonViewTrainee','UserLesson',{ID},'new_tab')"><div class="course-name">{sc_Name}</div></a>

And in CSS, I did this,

Code: Select all

a.No img {
	filter:grayscale(1);
}
a.No {
	pointer-events: none;
}
Without having to show different renderings of the same data, I just added classes and made the effective ones clickable and the uneffective ones unclickable and grayscaled.

Thanks for your time! :)
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: SHOW SECTION_START woes

Post by Jaymer »

Just today I was fighting with <<IF ... SECTION SHOW_START>>
Just didn't seem to work right - spent an hour on a form trying to get the results I wanted.
Seems like the <<IF>> is evaluated when the form is drawn, so while its not what you were doing, it wouldn't react to changes on the form dynamically.

anyway, thanks for this tip.

--> JaymerTip ( Tip from Khos on using a style/class to disable/gray data )
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: SHOW SECTION_START woes

Post by PointsWell »

Pomegranate wrote:Actually, I went another way,

I added a class to the a links like so

Code: Select all

<a class="{ValueTest}" href="#/" onclick="AwareApp.startProcess2('LessonViewTrainee','UserLesson',{ID},'new_tab')"><div class="course-name">{sc_Name}</div></a>

And in CSS, I did this,

Code: Select all

a.No img {
	filter:grayscale(1);
}
a.No {
	pointer-events: none;
}
Without having to show different renderings of the same data, I just added classes and made the effective ones clickable and the uneffective ones unclickable and grayscaled.

Thanks for your time! :)
Be mindful that when you move control to CSS you are moving security from the server to the client. Whilst it's unlikely that you are building a banking system, savvy users may be able to frig your security settings by using the browser console. It's a balance, if you are building a system for a youth club then CSS is appropriate, if you're building an audited system then this is a riskier approach.
Post Reply