How do I add 2 login info in Apk file?

Hi, to access web site with login and password, below code works fine.
But if I need to input 2 login name and 1 password, how to modify it ?

UB
usd2

What did you do in the html file?

Hi, i just want to login without putting id and password.

Well, that is not what you asked for in your first post ?

It seems you are using html for your login process, you were asked to show what you were doing in your html?

Thanks,
yes I want to access to wordpress website with login and password.
I just converted website into Apk with MIT App Inventor.
I added block so that it can access without inputting user id and password.
But there is a problem.
Wordpress site need 2 login ID and password.
How can I modify the block ?

If your login textboxes (and password box?) have ids, you may be able to run some javascript on the web page, after it has loaded, to set the textbox values. Something like:

document.getElementById("login1").value = "myName";
document.getElementById("login2").value = "myCode";
document.getElementById("password").value = "123456";

Thank you very much.
Yes, that web site (which is not my site) use javascript with ids.
Is that possible to convert html to apk with using webviewer ?
Do I need to add login ID and password in the block ?
What I want is to open that website without inputting login id and password.

Should be something like this:

HTML used:

<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<head>
	<title>WPLogin</title>
	<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
</head>

<body>
	<br><br>
	Login1
	<input id = "login1" type = "text" class="w3-input w3-border w3-round-large" style="width:200px" ><br>
	Login2
	<input id = "login2" type = "text" class="w3-input w3-border w3-round-large" style="width:200px" ><br>
	Password
	<input id = "password" type = "password" class="w3-input w3-border w3-round-large" style="width:200px" ><br>
	<input id = "button" type = "button" value="LOGIN" onclick="login()" class="w3-btn w3-ripple w3-blue w3-round-large"><br>
	
	
	<script>
	function login() {
	var l1 = document.getElementById("login1").value;
	var l2 = document.getElementById("login2").value;
	var p1 = document.getElementById("password").value;
	
	alert(l1 + " with " + l2 + " and " + p1 + ', Logged In');	
	}
	
	</script>
</body>

</html>

Also see:

How to fill out a form of a webpage and click a button using some JavaScript

2 Likes

Wow, great.
I tried and it worked fine.
If I don't need button click, how can I do it ?

I mean I just want to load the webpage without button click.

Remove the last element of the RunJavascript block

image

The user will then need to press the Login button on the web page.

Great! Thank you.
The last question.
When I close apk application (web view), sometimes logout is failed.
That is not good because sometimes the application shows some error to try to log in many times and ends up with the server error.
To fix the issue, I think it is better to logout the web before I log in the webpage, or do you think it is a good way to close website before log-in the web site ?

Not sure to be honest, may depend on the website or how the webviewer interacts with it. You could try clearing the cookies saved in the webviewer, this might create a fresh login each time ?