• Resolved eleist

    (@eleist)


    Hi,

    i have to range slider, height (h) and width (w).
    i need a formula that gives me a result depends on the two ranges.
    for ex:
    if h is betwenn 100 and 200 AND if w ist betwen 5 and 10, then give me the result 100
    if i raise the w between 10 and 20, result = 200

    i tried:
    if((100 < h && h <= 200) && (5 < w && w <= 10)) return ‘100’;
    if((100 < h && h <= 200) && (10 < w && w <= 20)) return ‘200’;

    but it doenst work.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @eleist

    Thank you very much for using our plugin.

    In this case you should implement the equation with a function structure. For example, assuming the fields for width and height are the fieldname1 and fieldname2 respectively, the equation could be implemented as follows:

    (function(){
    var w = fieldname1, h = fieldname2;
    if((100 < h && h <= 200) && (5 < w && w <= 10)) return 100;
    if((100 < h && h <= 200) && (10 < w && w <= 20)) return 200;
    })()

    Note, your equation does not include some possible options, like h<=100 or 200<h, or w<=5, or 20<w, even the combination of them.

    Best regards.

    Thread Starter eleist

    (@eleist)

    Looks good, but this is exactly what i have testet.

    (function(){
    var h = fieldname11, b = fieldname13;
    if(fieldname26=='yes')
     {
    if((100 < h && h <= 200) && (5 < b && b <= 10)) return '100';
    if((100 < h && h <= 200) && (10 < b && b <= 20)) return '200';
    if((100 < h && h <= 200) && (20 < b && b <= 29.5)) return '300';
    
    if((200 < h && h <= 250) && (5 < b && b <= 10)) return '700';
    if((200 < h && h <= 250) && (10 < b && b <= 20)) return '800';
    if((200 < h && h <= 250) && (20< b && b <= 29.5)) return '900';
     }
    
    else if (fieldname26=='no')
     {
    if((100 < h && h <= 200) && (20 < b && b <= 29.5)) return '1000';
    
    if((200 < h && h <= 250) && (10 < b && b <= 20)) return '1100';
    if((200 < h && h <= 250) && (20< b && b <= 29.5)) return '1200';
     }
    })();

    this doenst work for me. got no result displayed.

    Plugin Author codepeople

    (@codepeople)

    Hello @eleist

    Could you send me the link to your form to check the equation in action? Through the forum, I can check only the structure of the equation, but not the names or values of the fields. I need to check the whole.

    Best regards.

    Thread Starter eleist

    (@eleist)

    Hi,

    sorry, its on a local host.
    The form works fine without the double query “&& (10 < b && b <= 28)”. So the fields appear to be correct. Unfortunately, the browser console does not indicate any errors either.

    Is there another option to query a value between two ranges?

    I’m trying to create an online test account.

    Plugin Author codepeople

    (@codepeople)

    Hello @eleist

    As I said in the previous entry, the equation’s structure is correct. But probably, the fields’ values do not satisfy the conditions in the if conditionals statement.

    To demonstrate that the equation’s structure is correct, I tested it directly into the browser’s console by replacing the fields’ names with values. Please, watch the video by visiting the following link:

    https://resources.developers4web.com/cff/tmp/2022/03/15/video_o.mp4

    Best regards.

    Moderator Yui

    (@fierevere)

    永子

    @eleist

    I have removed your post. Please do not offer login to your site.
    see forum guidelines

    Also please refrain from using shortlinks, they are known to be used for various abuse.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @eleist You offered the developer admin access to your and if it comes to light that the developer did that for a forum user even off of the forum then @codepeople will lose access to the support forums. And their plugins may be removed from this site.

    I’ve flagged @codepeople account for moderation for that reason and archived their not useful reply.

    @codepeople While I know you have the best of intentions, it’s forum policy that you not ask users for admin or server access. Users on the forums aren’t your customers, they’re your open source collaborators, and requesting that kind of access can put you and them at high risk.

    If they are paying customers (such as people who bought a premium service/product from you) then by all means, direct them to your official customer support system. But in all other cases, you need to help them here on the forums.

    Thankfully are other ways to get information you need:

    You get the idea.

    We know volunteer support is not easy, and this guideline can feel needlessly restrictive. It’s actually there to protect you as much as end users. Should their site be hacked or have any issues after you accessed it, you could be held legally liable for damages. In addition, it’s difficult for end users to know the difference between helpful developers and people with malicious intentions. Because of that, we rely on plugin developers and long-standing volunteers (like you) to help us and uphold this particular guideline.

    When you help users here and in public, you also help the next person with the same problem. They’ll be able to read the debugging and solution and educate themselves. That’s how we get the next generation of developers.

    • This reply was modified 3 years ago by Jan Dembowski. Reason: Typo
    Plugin Author codepeople

    (@codepeople)

    Hello @jdembowski

    I’m not requesting WordPress access to the user. I requested the link to the public website page that includes the form to check the equation in action. I don’t need user access to check the equations because they are evaluated on the client-side (the browser).

    Best regards.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘A result depends on to ranges’ is closed to new replies.