Form header colour!

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Madimant
Posts: 37
Joined: Tue Aug 08, 2017 11:39 pm

Form header colour!

Post by Madimant »

I am trying to setup a form with a different header colours depending on a flag in the form data but I'm not good enough in scripting to work it out.

I have a BO form with some user data and a rule to check the data integrity that then sets a BO.AuditFlag = 'Yes" or "No" dependant on data integrity.
If the AuditFlag = "Yes" then want to have the Form Header color GREEN and if it is "No" then RED to alert the user.

Any help will be appreciated.

Tj
Tj
Using Version 9 Build 3259 - mySQL
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

working on this now for you...
but its going to involve the grid "custom header"

Have you seen this in the CRM sample?
Attachments
Screen Shot 2020-12-16 at 10.11.48 AM.png
Screen Shot 2020-12-16 at 10.11.48 AM.png (102.54 KiB) Viewed 6603 times
Last edited by Jaymer on Wed Dec 16, 2020 3:12 pm, edited 1 time in total.
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
Madimant
Posts: 37
Joined: Tue Aug 08, 2017 11:39 pm

Re: Form header colour!

Post by Madimant »

Thanks Jaymer...
Tj
Using Version 9 Build 3259 - mySQL
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

ok, thats not true. cause thats a grid header.
so ignore that post above.
Last edited by Jaymer on Wed Dec 16, 2020 3:25 pm, edited 1 time in total.
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
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

consider this from the CRM sample app.
the title "Jane Allison" comes from a custom header on the form.

the Customer form
Attachments
Screen Shot 2020-12-16 at 10.18.59 AM.png
Screen Shot 2020-12-16 at 10.18.59 AM.png (128.51 KiB) Viewed 6603 times
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
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

In the config tool, here's the default custom header, AND a modified one to make it RED

Default
Screen Shot 2020-12-16 at 10.26.19 AM.png
Screen Shot 2020-12-16 at 10.26.19 AM.png (135.75 KiB) Viewed 6599 times

Modified Code
Screen Shot 2020-12-16 at 10.27.57 AM.png
Screen Shot 2020-12-16 at 10.27.57 AM.png (60.17 KiB) Viewed 6599 times

Result
Screen Shot 2020-12-16 at 10.26.54 AM.png
Screen Shot 2020-12-16 at 10.26.54 AM.png (55.67 KiB) Viewed 6599 times
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
Madimant
Posts: 37
Joined: Tue Aug 08, 2017 11:39 pm

Re: Form header colour!

Post by Madimant »

If you see this header... the last word shows 'OK!' and the Banner is Green
Image

And in this one the Error code is 'CC | IN | RI' and the colour is Red
Image

I can hard code it in CSS with two different classes but just don't know how to select the relevant class and apply to the <div class=".vc-benefit-error"> or <div class=".vc-benefit-error"> when the flag changes from 'OK!'

The CSS will give me the two states

Custom CSS
.vc-benefit-error .k-state-selected {
background-color: #c13064;
color: #EEE;
}

.vc-benefit-ok .k-state-selected {
background-color: #30a5c1;
color: #EEE;
}
Attachments
Error_Banner.jpg
Error_Banner.jpg (38.76 KiB) Viewed 6524 times
OK_Banner.jpg
OK_Banner.jpg (42.81 KiB) Viewed 6524 times
Last edited by Madimant on Thu Dec 17, 2020 10:22 am, edited 2 times in total.
Tj
Using Version 9 Build 3259 - mySQL
Madimant
Posts: 37
Joined: Tue Aug 08, 2017 11:39 pm

Re: Form header colour!

Post by Madimant »

Sorry, my screenshots not working...
Pictures in attachments

In essence looking a 'If' type statement

if BO.AuditError = 'OK' then "formheader class=vc-benefit-ok"
else if BO.AuditError <> 'OK' then "formheader class=vc-benefit-error"

if that makes sense.

Thanks Jaymar
Tj
Using Version 9 Build 3259 - mySQL
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

yes, perfect.
so, here's a trick (shown to me long time ago by Mark B)

here's my form.
notice the last name.
its the name of the CSS class I want to use (in your case, the "error" or "ok" class)
Screen Shot 2020-12-16 at 11.01.48 AM.png
Screen Shot 2020-12-16 at 11.01.48 AM.png (50.52 KiB) Viewed 6582 times

And the new Custom Header
Screen Shot 2020-12-16 at 11.02.14 AM.png
Screen Shot 2020-12-16 at 11.02.14 AM.png (45.82 KiB) Viewed 6582 times
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
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

So...

add a field to the BO
set a rule to set the color field to either "xxx-error" or "xxx-ok"
and then just use the color field as the merge field <<Customer.color>>

The rule will always set it to one or the other.
Worse case is the class value doesn't exactly match a valid class, in which case it doesn't throw an error, it just doesn't color the field.
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
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

Also "k.state-selected" isn't doing anything in this context

And the CRM example used inline-styling a lot - better to have it like you do ALL in the CSS

And to make a shorter field, although 5 bytes vs. 16 bytes isn't going to make a diff,
but i'd probably use
.vc1 & .vc2 ( or maybe .vcok & .vcbad)
and just comment it in the .css
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
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Form header colour!

Post by Jaymer »

oh, and thx for getting rid of that screaming baby (or whatever it was) as your avatar - that thing always freaked me out!
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
hpl123
Posts: 2607
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Form header colour!

Post by hpl123 »

You can also use something like this (in the header HTML):
<<IF BO.AuditError = 'OK' THEN SHOW SECTION_START>>
// Show this
<<SECTION_END>>
<<IF BO.AuditError <> 'OK' THEN SHOW SECTION_START>>
// Show that
<<SECTION_END>>
Henrik (V8 Developer Ed. - Windows)
Madimant
Posts: 37
Joined: Tue Aug 08, 2017 11:39 pm

Re: Form header colour!

Post by Madimant »

Thank you Jaymar and Hendrik...

That will work for me. Needed the method to get the Attribute into a CSS class.

And sorry Jaymar about the 'screaming baby' . Was actually a very frustrated little girl ripping of her swimming goggles and say ' Enough of this S...'

Tj
Tj
Using Version 9 Build 3259 - mySQL
Post Reply