Auto form fill ~Help~

Mew
by Mew · 12 posts
12 years ago in Javascript
Posted 12 years ago · Author
alright you guys, i need a little help with this. i have been working on this all day and for some reason i just cannot get this to work...
i nee to use JavaScript/JQuery to auto fill forms? (or anything else that could do it)
do you know if this is even possible?

but i dont want to use like robo form or a browser plugin..
i want to be able to put the script on a web page, then when they click a button, it fills in the form, and submits and sends it to an email..
Posted 12 years ago
heathersboy17 wrote:
alright you guys, i need a little help with this. i have been working on this all day and for some reason i just cannot get this to work...
i nee to use JavaScript/JQuery to auto fill forms? (or anything else that could do it)
do you know if this is even possible?

but i dont want to use like robo form or a browser plugin..
i want to be able to put the script on a web page, then when they click a button, it fills in the form, and submits and sends it to an email..


Cross site scripting limitations will get in your way.
If you want to use javascript to do this, then you will need to use a combination of greasemony / xss exploits.
Posted 12 years ago · Author
darn.. i was really hopeing there would be a way to do it with all javascripting...

but what i was trying to do was use a script that i have that sends an alert pop up on page load, that shows their IP, MAC address, city, state, and zip code.
but i was going to remove the pop up and make it so the auto fill form would be set up with a hidden input that would auto put their IP address, then when they clicked the submit button (or whatever its for)
it will send an email to me that has their IP and all that...
but from what you said is this still not really possible?
Posted 12 years ago
heathersboy17 wrote:
darn.. i was really hopeing there would be a way to do it with all javascripting...

but what i was trying to do was use a script that i have that sends an alert pop up on page load, that shows their IP, MAC address, city, state, and zip code.
but i was going to remove the pop up and make it so the auto fill form would be set up with a hidden input that would auto put their IP address, then when they clicked the submit button (or whatever its for)
it will send an email to me that has their IP and all that...
but from what you said is this still not really possible?


We have something like that in The Vault, but it uses a combo of Javascript and PHP.

Wait, is this script being placed on the same domain as the form? If so, then it would work.
Posted 12 years ago · Author
Don Von Free Credits wrote:
heathersboy17 wrote:
darn.. i was really hopeing there would be a way to do it with all javascripting...

but what i was trying to do was use a script that i have that sends an alert pop up on page load, that shows their IP, MAC address, city, state, and zip code.
but i was going to remove the pop up and make it so the auto fill form would be set up with a hidden input that would auto put their IP address, then when they clicked the submit button (or whatever its for)
it will send an email to me that has their IP and all that...
but from what you said is this still not really possible?


We have something like that in The Vault, but it uses a combo of Javascript and PHP.

Wait, is this script being placed on the same domain as the form? If so, then it would work.


yes they would be placed on the same page
Posted 12 years ago · Author
well here is the code that i am using:

Code
<!-- Require jQuery / Anyversion --><script type="text/javascript" language="Javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- Require EasyJQuery After JQuery --><script type="text/javascript" language="Javascript" src="http://api.easyjquery.com/easyjquery.js"></script>
<script type="text/javascript" language="Javascript">
    // 1. Your Data Here
    function my_callback(json) {
        alert("IP :" + json.IP + " nCOUNTRY: " + json.COUNTRY);
    }

    function my_callback2(json) {
        // more information at http://api.easyjquery.com/test/demo-ip.php
        alert("IP :" + json.IP + " nCOUNTRY: " + json.COUNTRY + " City: " + json.cityName + " regionName: " + json.regionName);
    }

    // 2. Setup Callback Function
   // EasyjQuery_Get_IP("my_callback"); // fastest version
    EasyjQuery_Get_IP("my_callback2","full"); // full version
</script>


but i just realized this isnt the one that gets their MAC addresses lol
but the variable that gets the IP address is "json.IP" (i think lol)
Posted 12 years ago · Author
oh yeah lol i forgot about that one :oops:
Code
<div align="right" style="position:absolute;>
<form action="mailto:-removed-" method="post" enctype="text/plain" >
Avatar Name:<input type="text" name="+IPAddress"><br/>
<input type="hidden" name="IP" value="json.ip">
<input type="hidden" name="Email" value="removed eamil">
<input type="submit" name="Continue" value="submit">
</form>
</right>

i made them put their avi name 1. so i know who's IP i would get and 2. i could tell them when they enter their name they enter into a contest that someones holding lol
Posted 12 years ago
Give your input the ID of "IP" as well as the name of "IP".
Then give your form a name if you want to target it in Javascript.
Giving a form a name will not show up as valid code in a strict debugger, but it is more efficient than having your JavaScript search for the input by ID.
Once you give your form a name, you will be able to use this code to fill the input:

Code
document.FORMNAME.INPUTNAME.value = json.IP;


Otherwise you will have to use:
Code
document.getElementById("IP").value =  json.IP;

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT