Is there a function to count text fields?

  • membership.dsv
    Asked on July 14, 2020 at 4:09 AM

    I think the count() function is specifically limited to multiple choice questions. I have seen the demo.

    I would like to count how many text values have been filled without resorting to hidden fields.  At present I have logic that sets a 1 corresponding to each one when it is filled. There are only 4 text fields of interest. Then I sum these values. The sum goes through other calculations.  It would be great to be able to do the whole thing in a calculation widget.

    Is it possible to set the selections in a multiple choice with conditions?  Then I could use sum(), and reduce my hidden elements to 1, the multiple choice.

    Unfortunately the hidden values appear in the default email, but if I edit the email, I lose the default flexibility of not displaying empty fields.  If I'm wrong there, please put me straight.

  • Bojan Support Team Lead
    Replied on July 14, 2020 at 7:08 AM

    The only way to count the filled fields is using the way you have described: checking if the field is filled, filling a hidden text field with one, and then calculate the sum of hidden fields. 

    Unfortunately, it is not possible to dynamically add selections in the multiple-choice field. The only way to achieve this is to create multiple multiple-choice fields and hide the one you don't need using conditional logic.

    You should be able to remove the fields used for counting from the email, without losing the other information. Can you please share the form URL where this Notificaitonis located so we could take a better look?

    Thank you for your cooperation.

  • membership.dsv
    Replied on July 14, 2020 at 9:08 PM

    Thanks Bojan,

    It just occurred to me that it would be perfect if I could assign a calculation value to the text fields.  But I see that is not an option.

    I really do think that there is a need for a count() function that counted any element type that was filled.  Maybe that could be put  in the suggestion box.

    The URL is https://form.jotform.com/201878813627060

    In my form, I have the four hidden fields Child1 ...Child4 which serve the purpose described.  They are only used when the user selects "A Family Group" from the first multiple choice, and then only when one the corresponding Child x Name is filled.  Otherwise they are empty.

    All the options not selected and hidden by conditions are of course empty.

    So it would be handy to edit the email so the Childx fields don't appear, but I believe that this would cause all the other empty fields to be displayed.  I have not got my mind around this properly. 

    I have gone to a bit of trouble to remove nearly all the other hidden fields I created for ease of maintenance.  There is just one other left, 'Privacy'.

  • Amin JotForm Support
    Replied on July 15, 2020 at 2:46 AM

     What I think can sort this out is to create multiple auto-responder emails for each case, then create email conditions to trigger those emails based on whether X fields have been filled or not.

    This way, emails wouldn't contain any empty fields, and would properly include all data in case of filled out.

    Related guide: How-to-Send-Email-Based-on-User-s-Answer

    Does this look like something that would work for you?

  • membership.dsv
    Replied on July 15, 2020 at 4:28 AM

    Thanks Amin,

    I had a look at the guide.  A good solution so long as I can make do with two emails, since I am using a free account.

    Thanks for making the suggestion. I'll give it further thought.

    Can I use conditions so as not to send an email - that would give me three options.  It would seem that if the logic never returns a true condition then nothing would happen??

  • Amin JotForm Support
    Replied on July 15, 2020 at 6:39 AM

    Kindly note that emails involved in any Email Conditions never get triggered unless its requirement is fulfilled.

    For example, if you set Conditional Logic to send a specific email when a field(s) is filled, then that email would never be sent unless that filed(s) has been filled.