1

I've been struggling to capture user input using JavaScript and jQuery. I've tried using $("#userInput").val(),getNativeElementById("userInput").text/getText/getProperty("text").

I'm trying to build a user login screen and documentation is really not good.

Simon Dorociak
  • 33,374
  • 10
  • 68
  • 106
thorne51
  • 588
  • 7
  • 23

1 Answers1

1

I managed to get this to work (not using jQuery though), turns out documentation is wrong. Here is a working example:

var editbox = document.getNativeElementById("editbox");
editbox.getProperty(
    "text",
    function(property, value)
    {
        alert("Text is: " + value);
    },
    function()
    {
        alert("getProperty error");
    });

I created the edit box using this markup:

<div data-widgetType="EditBox" id="editbox"
    data-width="100%" data-text="Edit me" data-fontSize="20">
</div>

Here is the documentation:

http://www.mosync.com/files/imports/doxygen/latest/html5/mosync-nativeui.js.html#mosync.nativeui.NativeWidgetElement.getProperty

It says value and widgetID will be passed to the success callback, this is wrong, it is property name and property value that are passed.

Mikael Kindborg
  • 247
  • 2
  • 5