• Resolved thexamex

    (@thexamex)


    Hello,

    I have set the email field to appear only when the name input is entered. However, the email field only appears after the name input loses focus (i.e., when I click outside the name input field). This behavior is quite annoying. How can I change it so that the email field appears immediately once a valid name input is detected, without needing to click outside the name input field?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Amimul Ihsan Mahdi

    (@amimulihsanmahdi)

    Hi there,

    Currently, the conditional logic in Fluent Forms is designed to trigger when the value is focused out. I have added this as an improvement request and forwarded to our team.

    Thank you

    Thread Starter thexamex

    (@thexamex)

    Is there a way to change this behavior somehow? With custom code, hooks or actions? I really want to adjust this behavior until the definitive fix is out?

    Plugin Support Amimul Ihsan Mahdi

    (@amimulihsanmahdi)

    Hello There,

    In that case, you can use the below code:

    window.onload = function(){
    let firstName = document.querySelector("[name='names[first_name]']");
    let lastName = document.querySelector("[name='names[last_name]']");

    firstName.oninput = function(){
    firstName.dispatchEvent(new Event('change'));
    }

    lastName.oninput = function(){
    lastName.dispatchEvent(new Event('change'));
    }
    }

    Kindly make sure that your name field has the name attribute “names” as shown in the screenshot. The above code will trigger the change event manually for the name field which will trigger the conditional logic.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.