NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: rupertvz on March 30, 2022, 03:36:36 AM

Title: CSS Condition
Post by: rupertvz on March 30, 2022, 03:36:36 AM
Hi Guys,

I would like to set a CSS condition based on a Cookie value saved by NetTalk.

Has anyone done this, or have an example?

Thanks in advance!
Title: Re: CSS Condition
Post by: Bruce on April 03, 2022, 10:29:46 PM
Hi Rupert,

I'm not sure I understand what you have in mind here. Perhaps explain in more detail?
It's not even clear if you want to write Clarion code or JavaScript code to do this.

Cheers
Bruce
Title: Re: CSS Condition
Post by: rupertvz on April 04, 2022, 06:16:34 AM
Hi Bruce,

I have style sheets in a CSS file for my site.

1.  I want to be able to set a Cookie value via my NetTalk application.

2.  The CSS should then be able to read the Cookie (set by my application) and based on that - apply the correct CSS formatting.


Title: Re: CSS Condition
Post by: Bruce on April 05, 2022, 03:29:57 AM
>> The CSS should then be able to read the Cookie

As far as I'm aware, the CSS language has no ability to read cookies. So you will need to adopt another approach. (Since you don't mention what the _actual_ problem is, I can't suggest which approach would be best.)

I recommend you explain what your actual problem is, rather than search for advice on your proposed solution.

Cheers
Bruce
Title: Re: CSS Condition
Post by: Alberto on April 06, 2022, 09:04:40 AM
What about to change the CSS served by the browser based on a conditon?
if condition then Custon.css else Custon2.css end
Is that possible?
Regards
Title: Re: CSS Condition
Post by: Jane on April 06, 2022, 11:34:11 AM
What about to change the CSS served by the browser based on a conditon?
if condition then Custon.css else Custon2.css end
Is that possible?
Regards

Do you mean similar to what you can do by using the url http://127.0.0.1:88/?_theme_=morris

I'd guess you could do something in p_web.ChangeTheme in the web handler

IF get some value from cookie = blarg then   p_web.SetSessionValue('_theme_','blargTheme') .

??

Title: Re: CSS Condition
Post by: rupertvz on April 06, 2022, 11:53:51 AM
Hi Bruce,

I have a list of "Large Buttons" on my index page.
I would like to show the last button clicked in a different CSS style, say "blue" button.

Thus setting a cooking with the "value" of the last button clicked, then apply the CSS style for the particular button based on the cookie value.

As an alternative, I can probably create a duplicate of each button (with a different CSS style), and hide the second one for each button set initially.  Only showing the "second" button of a set when that set was last clicked.
Title: Re: CSS Condition
Post by: Niels Larsen on April 07, 2022, 01:44:16 AM
Hi

I would add this in the "Button CSS Class": choose(p_web.GetValue('myCookie')='xx',' class1',' class2')

/Niels
Title: Re: CSS Condition
Post by: rupertvz on April 07, 2022, 02:14:18 AM
Thank you Niels,

This is what I was looking for,
Thus the CSS class is able to read the Cookies.

Regards
Rupert