Adding autocomplete form support to webview

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
moraleda
In need of some credit
In need of some credit
Posts: 2
Joined: Mon Oct 25, 2021 8:35 pm

Adding autocomplete form support to webview

Post by moraleda »

I would like to add autocomplete support to a webview. I was not familiar with the control but I have been looking through its API and I am not sure how to implement it with the current API. Is this possible? Has anyone thought about this before?

Browsing the implementation (gtk, since I am on Debian) and it just occurred to me that perhaps it would not be too crazy to extend the public API of wxWebView to make it easier for an application to add autocomplete capabilities. Is this a good idea/direction?

My first thought was adding three new API methods to wxWebView that would:
  1. Get a list with all the <input> elements present in the currently loaded page.
    For an element we should be able to get its attributes. At a minimum, we would want "id", and "type", and possibly "name" and "autocomplete".
    Perhaps an optional "type" argument could be given to return only elements of the given type(s).
  2. Be able to get the current value of any such element given its id. Since the value depends on type, it would return wxVariant or something like it.
  3. Be able to set a new value for any such element given its id, with the same issue about polymorphism.
Has anyone thought about this before? Has any related work already been done? If I were to embark on some exploratory work, are any of you interested on collaborating on platforms I don't have access to? (i.e. Mac, perhaps MSW, although I could probably get some work done in VM).

Thank you,
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Adding autocomplete form support to webview

Post by doublemax »

In general, questions regarding extending the wxWidgets API are often better discussed at https://groups.google.com/g/wx-users , because there the core wx developers can see it. This here is a user forum.

However, as these functionality already exists in all browser engines, it might be better to give access to that, instead of developing it yourself. Especially when it comes to password fields and security becomes an issue.

For the wxWEBVIEW_BACKEND_EDGE backend under Windows this is already possible with some platform specific code.
Use the source, Luke!
Post Reply