4

I currently have a html web application which contains a hidden form:

<form id="loginForm" action="" method="post">
   <input id="login" name="login" type="hidden" placeholder="Login">
   <input id="pwd" name="pwd" type="hidden" placeholder="Password">
</form>

I use Javascript to populate 2 inputs (login, pwd) programatically. Then i look up the address of the device i want to post the information to (dynamic IP address) and post using javascript:

$('#loginForm').attr('action', data.address + "/login");
$('form').submit();

This works well, the device is an embedded controller, and logs me in.

I'm developing an App using codename one to mimic my web application, can i acheive the same somehow using browser component?

Thanks

A Houghton
  • 372
  • 5
  • 18

1 Answers1

0

No need for a form.

If I understood the code correctly you can use something like this:

String address = Socket.getHostOrIP();
Rest.post("https://myurl")
            .queryParam("action", address + "/login")
            .fetchAsString(response -> {});

I'm not sure about the address line, it will return the local device IP which seems weird for this use case.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65