Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Complex Javascript Formula Crashes the Page

$
0
0

Replies: 0

I want to create a Calculated Field (CF) with the following logic:

If user enters 5000 or less into fieldname1, then I want this CF to display 100.

If user enters anything higher than 5000 into fieldname1, then I want this CF to calculate 100 + 0.5%.

Using the Equation Tutorial, I saw that I can make complex functions using Javascript. When I enter the following logic into the equation editor, it crashes the page that the form is published on:

(function(){

if(fieldname1 > 5000) return fieldname1*0.005+100;

if(fieldname1 <= 5000) return 100;

})();

Can you please help?

  • This topic was modified 29 minutes ago by  teddyespo.

Viewing all articles
Browse latest Browse all 59525

Trending Articles