Forceing submit?

gameman

It's been a long, long time.
Reaction score
95
Code:
"document.getElementById('Hello').submit()"

I dont under stand why that isnt working.

this is the thing im trying to submit

Code:
<input type="password" class="bginput" id="Hello"/>
 

TFlan

I could change this in my User CP.
Reaction score
64
Javascript is case sensitive.
 

gameman

It's been a long, long time.
Reaction score
95
guys my problem is not solved yet

I originally ment "I copied it from the source and accidently left out the h."
 

TFlan

I could change this in my User CP.
Reaction score
64
well what do u want the script to do?
 

SFilip

Gone but not forgotten
Reaction score
633
What you want is to submit() the form, not an input box.
 

gameman

It's been a long, long time.
Reaction score
95
well what do u want the script to do?

Im sorry I need to stop my posting when im tired.
I am trying to create a greese monkey script that will allow me to login by pushing a button. here is the part of the script that controlls the login boxes.

Code:
		<!-- login form -->
		<form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
		<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=373"></script>
		<table cellpadding="0" cellspacing="3" border="0">
		<tr>
			<td class="smallfont" style="white-space: nowrap;"><label for="navbar_username">User Name</label></td>
			<td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" /></td>
			<td class="smallfont" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />Remember Me?</label></td>
		</tr>
		<tr>
			<td class="smallfont"><label for="navbar_password">Password</label></td>
			<td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td>
			<td><input type="submit" class="button" value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" /></td>
		</tr>
		</table>
		<!-- / login form -->

I already have a part of the script that auto types my name and password, but I cant find out how to do an action simmar to pressing enter.
 

UndeadDragon

Super Moderator
Reaction score
447
Give the submit button an id and use document.getElementById('Submit').submit()?
 

TFlan

I could change this in my User CP.
Reaction score
64
Code:
document.<form name>.submit()

Use that. Replace <form name> with the name of your form.

I see in your snippet there is no form name in your form.

Code:
<form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)" name="NAME_HERE">

Just replace NAME_HERE with whatever name you want (matching the Javascript given name of course).
 

TFlan

I could change this in my User CP.
Reaction score
64
Love it when I feel invisible. Look at my post.
 

TFlan

I could change this in my User CP.
Reaction score
64

TFlan

I could change this in my User CP.
Reaction score
64
Realized you were making an auto-login for TheHelper.net...

Would've been good to known that.

Use this to get the form as a variable.

Code:
var f = document.evaluate("//form[@action='login.php?do=login']",document,null,9,null).singleNodeValue,
    u = document.getElementById('navbar_username'),
    p = document.getElementById('navbar_password');

Infact...

Heres my version of the auto-login:
Code:
// ==UserScript==
// @name           The Helper Auto-Login
// @description    Automatically logins in to TheHelper.net when Username/Password is given.
// @namespace      http://userscripts.org/users/71106
// @include        http://www.thehelper.net/*
// @copyright      Tristian Flanagan
// ==/UserScript==

var username = GM_getValue('thelper_username', '');
var password = GM_getValue('thelper_password', '');

function doLogin(){
	var f = document.evaluate("//form[@action='login.php?do=login']",document,null,9,null).singleNodeValue,
		u = document.getElementById('navbar_username'),
		p = document.getElementById('navbar_password');
	if(username=="" || password==""){
		setFields();
	}else{
		u.value = username;
		p.value = password;
		f.submit();
	}
}

function setFields(){
	var thelper_username = prompt("Username:");
	var thelper_password = prompt("Password:");
	GM_setValue('thelper_username', thelper_username);
	GM_setValue('thelper_password', thelper_password);
	username = thelper_username;
	password = thelper_password;
	doLogin();
}

window.addEventListener('load', doLogin, false);
GM_registerMenuCommand('TheHelper.net Field Values', setFields);

EDIT::
Thanks for showing me this addon! I just made these kind of scripts for all my frequent websites I visit!
 

gameman

It's been a long, long time.
Reaction score
95
how exactly do you set it up?/work it?
maybe you can somehow make a little button next to the login button that runs it
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top