Form Search Criteria doesn't work as expected

I was working on TRUNK-5307, I discovered this bug.

Created a ticket here : https://issues.openmrs.org/browse/TRUNK-5430

I as well made further troubleshooting to figure out what causes this and I think I could push a PR to fix this.

cc: @dkayiwa, @wyclif