Skip Navigation

[Resolved] Use a javascript variable together with conditional output

This thread is resolved. Here is a description of the problem and solution.

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 6 years, 1 month ago. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 10 replies, has 2 voices.

Last updated by rexJ-2 6 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#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? hidden link

#1129387

Shane
Supporter

Languages: English (English )

Timezone: 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

Languages: English (English )

Timezone: 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

Languages: English (English )

Timezone: 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

Languages: English (English )

Timezone: 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

Languages: English (English )

Timezone: 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!