Support

Account

Home Forums General Issues Check if HTML input value == ACF field (!)

Unread

Check if HTML input value == ACF field (!)

  • Hi there,

    I’m using WordPress and Visual Composer to build a website. With ACF I’ve created a Field Group repeater (registration_codes) and in there, there is a field named ‘code’. I want to use this field to check an HTML generated <input> if the value is equal.

    Situation:
    People are getting a folder with a custom code in it, each month different code. This code will be added within the admin Dashboard via the code field. The input, created with Raw HTML on Visual Composer, needs to be equal to one of the codes. If so, redirect the visitor to the registration page. Currently got it working on javascript, but wanted to get this automated when a code was added within ACF. Summary: if [the input] == [one of the codes of the code field] then [redirect].

    Raw HTML on Visual Composer code:

    <form>
        <input id="pwd" type="password" placeholder="Password" name="pwd" style="font-size:16px;"/>
    </form>

    Raw Javascript/jQuery on Visual Composer code:

    $("#pwd").keyup(function() {
            if ($('#pwd').val() == "better"){ 
    $('#pwd').css({'background-color':'#63a521', 'color':'white'});
    setTimeout("location.href = 'http://www.example.com/registration';",500);      
            }
        });

    Please help me out, appreciate it!

    Regards,
    Sam

Viewing 1 post (of 1 total)

The topic ‘Check if HTML input value == ACF field (!)’ is closed to new replies.