Hi again! I’m making an app which loads data from an API and where users can post data to the API. Now my problem is that I don’t want people posting unwanted website links in there and I want to block offensive words too. Is there any way to do that In appGyver?
Well, that strictly depends on your app’s personal logic/design. The way I see myself doing it is using the if statements to check if the text contains any unwanted content. Then, if it does not (false), I would move forward with submitting it.
What this would do is it would create a list of words the text to submit has and then it would check each word against the list of banned words. If there is a banned word it would replace that word to asterisks if not then it returns the word that it checked. In the end to get back the text to submit it joins back all the words again.
Now this formula can be outplayed by adding any punctuation to the end of a banned word. So I have to think about it a little bit more to make it a really appropriate filter.
But use this formula where you set the text value to the create record or even before that, on the button tap event.
Now here you might want to test this because of performance issues. As it is basically a loop in the loop with nested ifs, so I suggest setting this value before the create record to make sure it has time to run before the request is triggered.
As for your question where to put this logic. Put it between the delay and the create record. Or between the false output of your pageVars.location=="" and create record (but this would skip the 1 s delay so think about it).
Cheers for @Kirill_Leventcov, for the CONTAINS() suggestion, that helped to avoid the punctuation marks.
Well… Yes… I mean you have to replace the “texttosubmit” to your specific property…
You have to create a bannedwords app variable. Populate that. And then use appVars.bannedwords there…
And it seems that I skipped a bracket (sorry for that, was typing riding the bike…)
And I think I have to do a little modification to the formula. I’ll write here soon.
So I have one problem, my post variables are stored in page variables which are later called in the create record process. When I try it, it always shows the error, even if I type hello. Can I just put the page variable for the input fields in the texttosubmit?