WebTextField.FieldType appears to do nothing at all

Setting the property in the IDE for Field Type, appears to be ignored at run time.

Attempting to set it in code is a bit of a mystery also. The following are resulting compiler errors:

me.FieldType=1
me.FieldType=“Email”
me.FieldType=Email

What am I Missing?

FieldType takes a WebTextField.FieldTypes enumeration value. For example,

me.FieldType = WebTextField.FieldTypes.Email

1 Like

Thanks Tim. I can now work around the IDE ignoring the settings.

It’s important to remember that not all browsers support all types. Other than “password” the other types are mainly exposed on mobile devices by way of changing the keyboard in use.

1 Like

I think that information should be added to https://documentation.xojo.com/api/user_interface/web/webtextfield.html#webtextfield-fieldtypes without a note or something I expect the WebTextField to work just like this:
image

Thanks Greg that explains a lot

If for example I have a password field and I want to put a button that allows me to show or hide it, it does NOT work.

if txtAccesoClave.FieldType = WebTextField.FieldTypes.Password then
txtAccesoClave.FieldType = WebTextField.FieldTypes.Normal
else
txtAccesoClave.FieldType = WebTextField.FieldTypes.Password
end if

I have a FR already for this.

Alguien a solucionado ésto de mostrar tipo Password o Normal con R2021 ?!

Hola Mauricio,

No. Y lo curioso es que esto si funciona:

If Self.TextField9.FieldType = WebTextField.FieldTypes.Password Then
  Self.TextField9.FieldType = WebTextField.FieldTypes.URL
Else
  Self.TextField9.FieldType = WebTextField.FieldTypes.Password
End If

Parece ser que .Normal sencillamente no genera el cambio a tipo “Text” :frowning:

Still there forgotten?

In some browsers, you can’t change the field type to/from the actual password type at runtime. Websites that offer this usually use CSS trickery to make the field look like a password field when they’re really not.

@Greg_O_Lone are you saying that Xojo is changing the type from ‘password’ to ‘text’ but the browser is not allowing the change?

Inspecting this process as it occurs in the DOM – and stepping through the update and render functions in JavaScript – it doesn’t look like the Xojo JavaScript framework actually changes the type of the field in Chrome on macOS. I worked up a simple WebTextField subclass to illustrate how this switching can be done using JavaScript. This could be modified to account for all other field types.

Or you could check out GraffitiTextField for Xojo Web. :slight_smile:

2 Likes

Please file a bug report.

<https://xojo.com/issue/64329>

Duplicate of 61967

Sure is. I couldn’t find it with a search and the original case ID was not shared above. @Greg_O_Lone can mark it as a duplicate.