Suppress the Submit Button Using the Relevant Column in Connect

09-26-2022 09:32 AM
Status: Open
Labels (1)
Occasional Contributor III
We would like to be able to take a geopoint, do a spatial query, and depending on the returned result, inform the user whether or not a specific type of recycling service is available in their geographic area.  If the service is not available then we don't want them to submit a survey at all.
We are currently trying to do this by getting the geopoint from the Address Question and doing the spatial query part using the Search function in the appearance column of a Select Multiple Question.  For example (abbreviated), search("area?url=https://.../MapServer/11", "intersects", "@geopoint", ${address_geopoint}).  When the recycling service will not be available again until next year in the user's area, for example, we remove the text from the Submit Button as seen here:


It's not ideal, but it works for the most part.  We are looking forward to point-in-polygon queries (
When the recycling service is available at the user's address, the user selects the (single) date that the service is available and the process of successively displaying more questions begins:


The problem is when the recycling service is not available, some users are hitting the unlabeled submit button anyway.  It not only might confuse them, but the data that we get ends up just containing their address and the select multiple answer that says the service is not available to them.  We are left with data we have to filter out of the because it is irrelevant, and we then wonder if those users are going to set items out for collection that we will not be coming to pick up.  Therefore it would be great to be able to suppress the Submit Button using the relevant column.

Tags (2)

Why not use a constraint on the question that says . != "no service yet" and make it required.  If there is just the one option then they cannot submit with that selected or leave it blank.  Maybe I am missing something but seems doable.



Thanks.  I have tried out your workaround.  You are right, it is doable. 

I hadn't used a Constraint in a production survey before and was concerned about the use of a function in one when I saw in the documentation "In the constraint expression, the input for the question is always represented by a period."  The documentation about Constraints doesn't happen to show any examples using functions, but it works (and looks odd).  All of our pickups are on Friday, so the constraint is starts-with(., 'Friday').

We would still prefer to be able to suppress the submit button.  The error message at the top might confuse the user.  They might think there is something they have done wrong and that they need to try to do something differently to get their mattress picked up.  It is misinformation.  There are no errors in the survey.





You do not have to use a period you can write out the ${fieldname} just like all other places.  In fact I use this a lot since when using > sometimes it things its HTML.


@DougBrowning @JamesTedrick 

Yes, it worked when I changed the constraint to:

starts-with(${pickup_area}, 'Friday')

"In the constraint expression, the input for the question is always represented by a period."  Seems pretty definitive.  I don't really see the need for shorthand here and prefer the long version for the sake of my coworkers who might have to tweak something if I am unavailable.  Good to know about the HTML confusion too.  Perhaps James Tedrick has something to add about this?



It would be interesting to show or hide the submit button based on one or more responses.