• Resolved Marek

    (@marek_wordpress)


    Hi,

    I want to ask you, if there is a possibility to write a condition based on the number that I type in the input.

    The condition:
    – if I type number 1 to the input -> show 1 new input
    – if I type number 2 to the input -> show 2 new inputs
    – if I type number 5 to the input -> show 5 new inputs
    – if I type number 10 to the input -> show 10 new inputs
    – and so on…

    It could be any number – so for example, if I type 100, 100 new inputs will show.

    Thank you very much for your response.

    • This topic was modified 6 years, 4 months ago by Marek.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    Not possible for the moment.

    I’m going to add repeatable fields in Conditional Fields Pro. So it will be possible to keep adding and removing as many fields as you’d like.

    I guess once this is in place it won’t be hard to base the number of repetitions on another field’s value.

    Thread Starter Marek

    (@marek_wordpress)

    Hi,

    So I tried to solve the problem this way:

    In my form I have:

    <label> Number of people *
    [select* number-of-people first_as_label “– Select –” “1” “2” “3”] </label>

    [group age-1]
    <p class=”p-label”>Enter the age of all persons *</p>
    <p>[number number-1]<p>
    [/group]

    [group age-2]
    <p class=”p-label”>Enter the age of all persons *</p>
    <p>[number number-1]<p>
    <p>[number number-2]</p>
    [/group]

    [group age-3]
    <p class=”p-label”>Enter the age of all persons *</p>
    <p>[number number-1]<p>
    <p>[number number-2]</p>
    <p>[number number-3]</p>
    [/group]

    and in email body I have this:

    All ages:
    [number-1]
    [number-2]
    [number-3]

    But when I got the email I do not see All ages.

    I also tried this:

    [age-1]
    [number-1]
    [/age-1]

    [age-2]
    [number-2]
    [/age-2]

    [age-3]
    [number-3]
    [/age-3]

    and it is still not working.

    Could you help me with this?

    Thank you.

    • This reply was modified 6 years, 4 months ago by Marek.
    Plugin Author Jules Colle

    (@jules-colle)

    All field names need to be unique. So that won’t work.

    What will work is this:

    <p class="p-label">Enter the age of all persons *</p>
    [group age-1]
    <p>[number number-1]<p>
    [/group]
    [group age-2]
    <p>[number number-2]</p>
    [/group]
    [group age-3]
    <p>[number number-3]</p>
    [/group]

    Conditions:

    show age-1 if number-of-people = 1
    show age-2 if number-of-people = 1
    show age-2 if number-of-people = 2
    show age-3 if number-of-people = 1
    show age-3 if number-of-people = 2
    show age-3 if number-of-people = 3
    • This reply was modified 6 years, 4 months ago by Jules Colle.
    Thread Starter Marek

    (@marek_wordpress)

    It works vice versa:

    if I choose number 3, it will show 1 input,
    if I choose number 2, it will show 2 inputs,
    if I choose number 1, it will show 3 inputs

    It should work this way:

    if I choose number 1, it should show 1 input,
    if I choose number 2, it should show 2 inputs,
    if I choose number 3, it should show 3 inputs

    Plugin Author Jules Colle

    (@jules-colle)

    You can figure it out. I believe in you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Condition based on number in input’ is closed to new replies.