• Resolved jpgoem

    (@jpgoem)


    Hello,

    Is it possible to apply a function (ex. a hash or other text functions) to a text field (an email field or a name field, for example) ? The idea is to compare the result of the function with another input field for validation/authorization.

    I know the calculation field, where numerical calculations and functions can be performed, but this only works on numerical fields, not on text fields.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @jpgoem

    I hope you are doing well today.

    At the moment validation is only available for the Password field. The solution for the text field is only to use conditional logic to check if the previous field contains a specific value. For example:

    • you create text field 1
    • you create text field 2
    • you create HTML field and in conditional logic you set up rules as:

    SHOW || ALL

    • text 1 contain SOME_VALUE
      text 2 contain SOME_VALUE

    As a result, you will end up with a scenario to shows an HTML field with custom text (some error message for example) only if in both fields same value will appear. Let’s say SOME_VALUE is “abc”, you type in field 1 “testabc” and in field 2 “forminator”, rules will not match. But as soon you type in field 2 “Forminator” or “Forabcminator” rules will match and the HTML field will show up.

    Please let us know more details about your goal, so we could check if any of default rules can help in that matter.

    Kind Regards,
    Kris

    Thread Starter jpgoem

    (@jpgoem)

    Hi Kris,

    Here is my goal :

    I generate (in Excel) a series of coupons that are derived from the email address of the sponsors (for example the first 5 characters of an MD5 hash of the email address). The coupons are therefore unique per sponsor.
    In the form I want to compare the coupon entered by the user with the one that is derived from the email address of the sponsors. The promo is only awarded in the event of a match.

    In your example, field1 would be the coupon. Field2 is the email address of the sponsor. An operation on field2 should result in field1 for a match.

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @jpgoem,

    There’s no MD5 function in Forminator calculations. Therefore, the simplest way would be to use a list of the MD5 hashes (already generated), which you could use for matching with the promo codes, using the visibility conditions.

    However, that may not be the best method, since the codes can be found in the source HTML code of the page.

    An alternative would be a kind of server-side validation, programmed with PHP instead of JavaScript, so that your promo code can’t be seen in the source code via browser.

    Such programming goes beyond the scope of our support, and you may consider hiring a developer for this kind of task. For instance, check out WordPress jobs directory here: https://jobs.wordpress.net/

    If you need further advice about it, please feel free to email us at wpsupport@incsub.com.

    Best Regards,
    Dmytro

    Hi @jpgoem

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!

    Kind Regards,
    Kris

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘function on text input fields’ is closed to new replies.