1

I'm trying to display form entries from Sprout Forms that match a specific criterium:

{% for formEntry in craft.sproutForms.entries.formHandle('formHandle').fieldname('fieldvalue') %}
    {{formEntry.fieldname}}
{% endfor %} 

This does not filter the entries.

This works:

{% for formEntry in craft.sproutForms.entries.formHandle('formHandle') %}
    {% if fieldname == 'fieldvalue'%}
        {{formEntry.fieldname}}
    {% endif %} 
{% endfor %} 

Can this not be done with parameters, or am I using the wrong Entry model?

  • PS; I assume fieldname should be fieldhandle – noregt Jan 6 '16 at 9:15
4

Filtering entries is now possible as of Sprout Forms v2.2.0:

{% for formEntry in craft.sproutForms.entries.formHandle('contact').firstName('Zoe') %}
  ...
{% endfor %#}
  • I've updated, but can't test it because now it produces an error in the assets field. see my support mail – noregt Feb 5 '16 at 9:37
  • Updated to 2.2.1 and everything works like expected now :-) – noregt Feb 6 '16 at 10:38
1

I believe this should work...

{% for formEntry in craft.sproutForms.entries.formHandle('formHandle').search('fieldname:fieldvalue') %}
    {{formEntry.fieldname}}
{% endfor %} 
  • This only works partly. "search('fieldvalue')" works, but is insufficient. search('fieldname:fieldvalue') returns nothing. PS; I think it should be fieldhandle, but that gives the same results. – noregt Jan 6 '16 at 9:14
  • 1
    With the latest update to 2.2.1 this now works like it should, thanks – noregt Feb 6 '16 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.