WebTextArea contents changing to the word "undefined"

I have a web app deployed in which a handful of users out of a couple of hundred cannot enter anything as the text changes to the word “undefined” when the code copies the contents to a dictionary which I subsequently post to the database. I am unable to duplicate the problem so cannot run it in the debugger to actually see happen.

The users are limited to 250 words, about 1800 characters. Here is a code snippet from the save button on the page which includes a couple of tests I put in to help me figure what is causing the problem…

[code] abstractTest =txtAr_Abstract.Text
session.Project.Value(“projectSummaryWasUndefined”) = “false”
session.Project.Value(“projectSummary”) = ReplaceLineEndings(txtAr_Abstract.Text,EndOfLine)
if session.Project.Value(“projectSummary”) = “undefined” then
session.Project.Value(“projectSummary”) = abstractTest
session.Project.Value(“projectSummaryWasUndefined”) = “true”

  end if[/code]

This code is wrapped in a couple of if statements…
If txtAr_Abstract.text <> “” then
If txtAr_Abstract.text <> session.Project.Value(“projectSummary”) then

I put the if statement in the above snippet to see if the text was changed before the post to the database, which as you can see it is. I also wanted to remove the possibility that the ReplaceLineEndings function was causing the problem. I will be revising this slightly tonight to save txtAr_Abstract.Text directly to the dictionary instead of the abstractTest variable.

The dictionary is sent to the database which returns the dictionary received and xojo diplays it on a different page. I can read the dictionary in the database and so doing have confirmed that the “defined” is being saved to the dictionary instead of the entered text in xojo before posting to the database.

Anyone see what might be causing the problem. There are a couple of possibilities that might be causing the problem. One might be the length of the text? Is there a limit to what can be enteed in a text area or stored in a dictionary. It’s got to be far greater thatn 1800 characters. Another issue might be how the user is entering the text. We have directed them to type it in, but we have no control of how they do it. Some may be copying the text from GoogleDocs or a word processor. This has caused us problems in the past with unrecognized characters being injected in the text. This is the first time I have seen this problem with “undefined”.

Thanks for any help.

John

It’s usually the Grammarly plugin with the user’s browser.

https://forum.xojo.com/39275-textarea-text-returns-undefined-when-using-grammarly-in-a-webap

Thanks so much. Don’t know if Grammarly plugin is my problem but I put the code given in Michel Budardet’s link in my offending textarea. So far so good.

Doe anyone know if any other objects like textfields are in conflict with Grammerly, or is it just WebTextAreas.

Thanks,

John

Aha! I think @Michel Bujardet’s findings regarding the Grammarly extension for Chrome also applies to 1PasswordX, the newest iteration of 1Password’s Chrome extension that does not require a desktop app.

Looks like 1PasswordX uses a “data-op-id” attribute to mark a password field and then overlays a div that contains a button, no doubt this is the source of the “undefined” values I’ve seen with 1PasswordX (see https://forum.xojo.com/44300-1password-x-in-google-chrome-sets-webtextfield-text-to-undefine/).

When I get a chance I’ll have to see if @Michel Bujardet’s solution also applies to 1PasswordX.

I am not familiar with that utility, but undefined means indeed that the utility replaces the original HTML control by something else. I would try to contact Agilebits to know if they have a workaround.

The 1Password team is also way more responsive and helpful than the Grammarly people. If you have an issue with 1Password’s way of filling forms, show them the problem and how to reproduce it and they’re pretty good about fixing things!

I would say reach out to 1Password with details about the issue, they may be able to fix it for Xojo apps :slight_smile: