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?

1
  • PS; I assume fieldname should be fieldhandle Commented Jan 6, 2016 at 9:15

2 Answers 2

4

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

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

I believe this should work...

{% for formEntry in craft.sproutForms.entries.formHandle('formHandle').search('fieldname:fieldvalue') %} {{formEntry.fieldname}} {% endfor %} 
2
  • 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. Commented Jan 6, 2016 at 9:14
  • 1
    With the latest update to 2.2.1 this now works like it should, thanks Commented Feb 6, 2016 at 10:39

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.