• Resolved shawnm1

    (@shawnm1)


    How would one go about imposing a required length on a field response? For example: field requires your ID number, and your response must be at least 9 characters long

    • This topic was modified 1 year, 2 months ago by shawnm1.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author EDGARROJAS

    (@edgarrojas)

    This could be done by creating a validation condition using the formula builder (section 3 of this guide: https://sfmanual.rednao.com/documentation/conditional-logic/doing-calculations-in-conditional-logics/)

    A formula like this should work:
    String($$field_rnField36$$).length<9

    Change rnField36 for the field id that you want to validate.

    Regards!

    Can’t quite get it to work correctly. In this scenario, in the conditional logic builder, you’d set the field to be invalid based on the condition, correct?
    So it’d look something like:
    Invalid if: ID – equal – String(ID).length<9

    Or should “operation” be set to something other than equal?
    Also, I’m using a Number field type, if that makes a difference.

    Plugin Author EDGARROJAS

    (@edgarrojas)

    You actually don’t use the operator, you have to use the formula builder in the conditional logic like in the section 3 of the tutorial https://sfmanual.rednao.com/documentation/conditional-logic/doing-calculations-in-conditional-logics/. In there you can use the code that i sent you (you just need to replace rnField36 for your real field id) and the condition should work fine.

    Regards!

    The picture in the guide shows the formula builder, which is fine. I used that, had it validate, and it did so successfully. When I click next, I just get an error telling me to “please fill in all fields”.

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Weird, do you have the latest version of the plugin?

    No, we actually had to backpedal after the last update. Weren’t able to interact with forms on mobile. I saw someone else posted about that too. I saw you posted some CSS to fix it. But we use a LOT of forms, and it was easier in the short term to stay up and running if we stepped back a version rather than go in and make the CSS edits.

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Ok, could you update and see if it works? The error that you described is similar to an issue that was fixed some releases ago. Also if you prefer you could paste that css in the Woocommerce dashboard(Appearance->Customize->Additional CSS) that way the style would be applied to all the pages (it shouldn’t affect any other section of your page since the css classes that the style use are specific for the plugin).

    Regards!

    It works!!!!!! THANK YOU!

    Discovered a small issue – numbers beginning in 0 are rejected. I’m assuming its a data type conversion problem?

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Weird, i just tested and it worked for me. Could you create a separate thread for this issue? Please include a link to your form if possible and the steps to reproduce it (like what input box are you filling and with which value).

    Regards!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Field Lengths’ is closed to new replies.