Navigation überspringen

[Gelöst] Use a javascript variable together with conditional output

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

The issue here is that the user wanted to add JS code to our conditional statements

Solution:

Unfortunately it is not possible to add javascript code to our conditional statements

This support ticket is created vor 6 Jahren, 2 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 10 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von rexJ-2 vor 6 Jahren, 2 Monaten.

Assistiert von: Shane.

Author
Artikel
#1129329
Skærmbillede 2018-10-17 kl. 08.16.49.png

Tell us what you are trying to do?
Want to be able to use javascript variables into conditional output for comparing.

Is there any documentation that you are following?
no.
Is there a similar example that we can see?
no
What is the link to your site? versteckter Link

#1129387

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Rex,

Thank you for contacting our support forum.

Unfortunately no it is not possible to use JS variables here.

Thanks,
Shane

#1129592

Thanks but how can i do the following condition in "Templates for this view (field aftale is a Datetime):

[wpv-conditional if="( $(wpcf-dato).id(aftale) eq 'TODAY()' )" evaluate="true"]<td>[wpv-post-title]</td>[/wpv-conditional] 

The problem are that TODAY() (time at 00:00 on today) i have to show all day. Think i have to use som BETWEEN and still is a date unsigned and is it possible to do it in a template view?
Regards

#1130133

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Rex,

To perform a BETWEEN operation it would look something like this.

[wpv-conditional if="( $(ajax_submission) lte '' ) AND ( $(ajax_submission) gte '' )"][/wpv-conditional]

This should work for you.

Please let me know if this helps.

Thanks,
Shane

#1132545

hi, what is this "something" i do not understand.
Kind regards henrik

#1132795

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Rex,

When I saw "something" , i'm referring to the example below.
[wpv-conditional if="( $(ajax_submission) lte '' ) AND ( $(ajax_submission) gte '' )"][/wpv-conditional]

Thanks,
Shane

#1133223

But when i replace

[wpv-conditional if="( $(wpcf-dato).id(aftale) eq 'TODAY()' )" evaluate="true"]<td>[wpv-post-title]</td>[/wpv-conditional] 

with

 [wpv-conditional if="( $(ajax_submission) lte '' ) AND ( $(ajax_submission) gte '' )"][/wpv-conditional]

its not working

#1133642

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Rex,

What is "ajax_submission". If this is a value from an Ajax request then this won't work.

It has to be a php function or a shortcode.

Thanks,
Shane

#1134081

Ok. Seems i have to find out myself.
Thanks

#1134382

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Rex,

Could you confirm if the issue has been resolved?

Thanks,
Shane

#1134824

Stopped working on it. used php and wordpress shortcodes on a project!