Problem to scrubbing textbox in contact form

Hello everybody!

In this post, I showed the way to make the contact form in my project, but I need to scrubbing the textbox to avoid poisoning by "&" in subject or body.

Indeed, just as @ABG told me, when I write "&" in subject or body the app doesn't recognize the symbol and, instead of it, a space is displayed.

I tried to add the block "Web1.URIEncode" between the blocks "set ActivityStarter1 - DataUri" and "join", but it doesn't work.

Do you know how can I solve this problem, please?

Thank you so much in advance!

PD: @ABG, apologies for not replying in the original post. Last days, it has been impossible for me to get in here. I decided to open a new post with it in case more people have the same problem.

You will need to do some replacements

For example replace & with %26 - the ASCII Hex representation of &

You may want to build a result procedure to handle all the most likely characters....

image

1 Like

@TIMAI2, when I replace & with %26, Gmail doesn't show the text I write in the body of the app's contact form. :frowning:

Odd, works OK on Gmail here

1 Like

The alternative is to prevent the use of these characters in the subject and message by either replacing them with words or using Taifun's textbox extension to handle them live as they are typed in.

1 Like

Great! I'm going to try it. I'll let you know how it works.

Thanks a lot! :slight_smile:

@TIMAI2, where did you get the purple blocks " call text" and "to result"?

I don't find it in my App Inventor.

@TIMAI2, I tried with these blocks, but it doesn't work.

Any suggestion, please?

Those text replacements would make more sense on the inputs into that big JOIN.

1 Like

@ABG, I did it and doesn't work. :pensive:

well, what about first replace the unwanted characters and then build together the data uri?
Taifun

2 Likes

Procedure blocks:

http://ai2.appinventor.mit.edu/reference/blocks/procedures.html#return

image

1 Like

@TIMAI2, I did it like this and works perfectly.

Thank you so much! :slight_smile:

@Taifun, definitely, with this block structure it doesn't work. However, removing the blocks "set subject text" and adding the blocks "call text" and "to result" from "procedure", it is working excellently.

Thank you so much! :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.