473,609 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

robot javascript HELP!

Hi,

I need to make a robot that fills forms. I already made that with php
sites, but now I need that in a javascript pages site ( the robot can
be php,asp, asp.net ), anyone knows how can I do it? or somewhere I can
find more info?

Thanks!

Marcelo

May 10 '06 #1
11 2142
Marcelo wrote:
Hi,

I need to make a robot that fills forms. I already made that with php
sites, but now I need that in a javascript pages site ( the robot can
be php,asp, asp.net ), anyone knows how can I do it? or somewhere I can
find more info?

Thanks!

Marcelo


Hi,

Do you want a JS script that fills in a form?

JS must be on the same page as the form, or you might hit into
security-issues.
(If you want to fill a form on another window.)

If it is on the same page, just fill in what you want like this:

<form action="bal.php " name="myForm">
firstname: <input type="text" name="firstname " value="">
<br>
lastname: <input type="text" name="lastname" value="">
<br>
<input type="submit" value="send">
</form>

<script type="text/javascript">
// fill it
document.forms["myForm"].firstname.valu e = "Zaphod";
document.forms["myForm"].lastname.value = "Beeblebrox ";
// send it
document.forms["myForm"].submit();
</script>
Is that what you are looking for?

Regards,
Erwin Moller
May 10 '06 #2
Hi,

Thanks for the answer.

I want that php fills a javascript form, but I don't know how to send
the values or select the values of combo boxes ( in some cases ).

Best Regards

Marcelo

May 10 '06 #3
ASM
Marcelo a écrit :

I want that php fills a javascript form, but I don't know how to send
the values or select the values of combo boxes ( in some cases ).

Usually a form is written and works in html.
Scripts in JS are only to help in filling fields by users(*)
Scripts in php can pre-fill fields or/and display necessary options of
selects

Php knows how to receive fields or combo boxes values,
there is nothing to do in JavaScript to send those.
On re-issue of form from php, the php fills fields it knows.

(*) JS looks if fields are filled up and, if not, prevent submit
<form onsubmit="retur n validate(this)" blah ...>

function validate(aForm) {
for (var i=0;i<aForm.len gth;i++) {
if(aform[i].type == 'text' && aForm[i].value == '') {
alert(txt+aForm[i].name);
aForm[i].focus();
aForm[i].select();
return false;
}
if(aform[i].type == 'select' && aForm[i].value == '') {
alert('Please choice in list : '+aForm[i].name);
aForm[i].focus();
aForm[i].select();
return false;
}
if(aform[i].type == 'radio') {
var e = aForm.elements[aForm[i].name];
if(e.length>0) {
var ok = true;
for(var j=0;j<e.length; j++) if(e.[j].checked) ok=false;
if(ok) {
alert('Please choice : '+aForm[i].name);
aForm[i][0].focus();
return false;
}
}
}
}
return true;
}

--
Stephane Moriaux et son [moins] vieux Mac
May 10 '06 #4
Thanks for the info, so It can't be do it? ( with php or asp ala
"robot form filler" ), can be do it with a win 32 app?
Basically I need something that hide some fields of a webpage and show
partially in other site.
field1 field2 field3
â–¼
page1(form in javascript)
â–¼
site1
â–¼
site2 ("masked site")
â–¼
page1
â–¼
field1 field2
â–¼
USER ( only see 2 fields )
Thanks

MARCELO

May 11 '06 #5
Marcelo wrote:
Hi,

Thanks for the answer.

I want that php fills a javascript form, but I don't know how to send
the values or select the values of combo boxes ( in some cases ).

Best Regards

Marcelo


Hi Marcelo,

I think you are confusing two things: serverside and clientside.
1) PHP runs only at server, and produces HTML and the Javascript.
2) The delivered HTML (including JS) is executed in a client (=browser).

So you cannot directly let PHP fill a form.

Of course, you are free to let PHP fill in values for formelements, and let
PHP SELECT some options in a SELECT or in a RADIO typed formelement, but
remember that this must happen at 'producetime', that is when you make the
HTML.
Once PHP has delivered the HTML, it is completely out of touch with the HTML
page.

So when you write: "I want that php fills a javascript form", do you mean
you KNOW what values you want in the form?

Please rephrase your question (or rethink your design).

If you want to let your form on the client communicate with some PHP scripts
on some server, solutions exists (AJAX comes into mind), but I am unsure
what you want.

Good luck!

Regards,
Erwin Moller
May 11 '06 #6
Hi Erwin,

I need a roobot that fills a form, I already made that with php (
sending the url with values ) but i want to make the same thing on a
javascript page, so I don't know how to send the values
So when you write: "I want that php fills a javascript form", do you mean
you KNOW what values you want in the form?


Yes I know

Thanks

Regards

Marcelo

May 11 '06 #7
ASM
Marcelo a écrit :
Thanks for the info, so It can't be do it? ( with php or asp ala
"robot form filler" ), can be do it with a win 32 app?
Basically I need something that hide some fields of a webpage and show
partially in other site.
field1 field2 field3
â–¼
page1(form in javascript)
it is what I don't understand : why a form in JS if you use php ?
â–¼
site1
â–¼
site2 ("masked site")
â–¼
page1
â–¼
field1 field2
â–¼
USER ( only see 2 fields )
Thanks

MARCELO


[ = PHP = ] _______________

To non display a fild already filled up :
(it will be write in html code and will be submit with others fields in
same form)

<input type="text" name="field1"
<? if(isSet $field1) echo "style=\"displa y:none\""; ?>
value="<? echo $field1 ?>" >

or to do not write it if previously filled up

<? if(!isSet $field1) { ?>
<input type="text" name="field1">
<? } ?>

same with a combo box

<select name="combo1">
<? if($combo1 != 'apple')
echo "<option value=\"apple\" >Apple</option>\n";
?>
[ = JS = ] _______________ _______
(not a good idea) (suppose you are in php)
Will virtally only write empty fields

<?
/* php to set/get php _POST variables */
?>
<html>
<script type="text/javascript">
var fld = new Array();
fld[1] = '<? echo $field1 ?>';
fld[2] = '<? echo $field2 ?>';
function setFields() {
var txt = '';
var ok = false;
for(var i=0;i<fld.lengt h;i++)
if(fld[i] != '') {
txt += '<input type="text" name="field'+(+ 1+i)+'">
ok = true;
}
if(ok) txt += '<input type="submit" value="pronto"> ';
document.write( txt);
}
</script>
<form name="form1" action="myPhp.p hp" method="post">
<script type="text/javascript">
setFields();
</script>
</form>
</html>
--
Stephane Moriaux et son [moins] vieux Mac
May 11 '06 #8
ASM
Marcelo a écrit :
Thanks for the info, so It can't be do it? ( with php or asp ala
"robot form filler" ), can be do it with a win 32 app?
Basically I need something that hide some fields of a webpage and show
partially in other site.
field1 field2 field3
â–¼
page1(form in javascript)
it is what I don't understand : why a form in JS if you use php ?
â–¼
site1
â–¼
site2 ("masked site")
â–¼
page1
â–¼
field1 field2
â–¼
USER ( only see 2 fields )
Thanks

MARCELO


[ = PHP = ] _______________

To non display a fild already filled up :
(it will be write in html code and will be submit with others fields in
same form)

<input type="text" name="field1"
<? if(isSet $field1) echo "style=\"displa y:none\""; ?>
value="<? echo $field1 ?>" >

or to do not write it if previously filled up

<? if(!isSet $field1) { ?>
<input type="text" name="field1">
<? } ?>

same with a combo box

<select name="combo1">
<? if($combo1 != 'apple')
echo "<option value=\"apple\" >Apple</option>\n";
?>
[ = JS = ] _______________ _______
(not a good idea) (suppose you are in php)
Will virtally only write empty fields

<?
/* php to set/get php _POST variables */
?>
<html>
<script type="text/javascript">
var fld = new Array();
fld[1] = '<? echo $field1 ?>';
fld[2] = '<? echo $field2 ?>';
function setFields() {
var txt = '';
var ok = false;
for(var i=0;i<fld.lengt h;i++)
if(fld[i] != '') {
txt += '<input type="text" name="field'+(+ 1+i)+'">
ok = true;
}
if(ok) txt += '<input type="submit" value="pronto"> ';
document.write( txt);
}
</script>
<form name="form1" action="myPhp.p hp" method="post">
<script type="text/javascript">
setFields();
</script>
</form>
</html>
--
Stephane Moriaux et son [moins] vieux Mac
May 11 '06 #9
ASM
Marcelo a écrit :
Hi Erwin,

I need a roobot that fills a form, I already made that with php (
sending the url with values ) but i want to make the same thing on a
javascript page, so I don't know how to send the values

So when you write: "I want that php fills a javascript form", do you mean
you KNOW what values you want in the form?

Yes I know


to non visually display fields by javascript :

<?
/* php to set/get php _POST variables */
?>
<html>
<script type="text/javascript">

var fld = new Array();
fld[1] = '<? echo $field1 ?>';
fld[2] = '<? echo $field2 ?>';

function hideFields() {
var f = document.forms['form1'];
var j = 0;
for(var i=0;i<f.length; i++)
if(f[i].type == 'text') {
if(fld[j] != '')
f[i].style.display = 'none';
j++;
}
}

onload = hideFields;

function showHideField(f ieldName,what) {
var f = document.forms['form1'].elements[fieldName];
if(f.style.disp lay != 'none') {
f.style.display = 'none';
what.value = 'Show '+fieldName;
}
else {
f.style.display = 'inline';
what.value = 'Hide '+fieldName;
}
}

</script>
<form name="form1" action="myPhp.p hp" method="post">
<p>Field 1 : <input type="text" name="field1"
value="<? echo $field1 ?>">
</p>
<p>Field 2 : <input type="text" name="field2"
value="<? echo $field2 ?>">
</p>
<p><input type="submit" value="Send">
</p>
<p><input type="button" value="Show/Hide Field 1"
onclick="showHi deField('field1 ',this);">
<input type="button" value="Show/Hide Field 2"
onclick="showHi deField('field2 ',this);">
</p>
</form>
</html>

--
Stephane Moriaux et son [moins] vieux Mac
May 11 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6127
by: Adrian Lumsden | last post by:
Hello, I have an app where I have to screen scrape to capture an image from a JMF film player. The user is given a dialog with a list of frames that can be exported as images. If the one they chose contains the JMF film player then I use the Robot to scrape the pixels off the screen. Problem is that the dialog which they used is often still left on the screen
0
1254
by: Jonathan Vance | last post by:
I am looking for a python robot that Van Rossum released with python 0.9.8. It may have been the first web robot (see http://www.webhistory.org/www.lists/www-talk.1993q1/0060.html). I've had no luck finding the code for the robot or the 0.9.8 tarball. Can anyone help me out? Thanks.
1
1948
by: Paul Dennis | last post by:
Hi, I'm trying to write a web robot using JavaScript. It's objective would be to surf around and look for patterns in the way web pages link to each other or in the text they contain. Data would be returned in a web box which could later be copied into another application. That's not to tough a challenge. I can make a
78
6196
by: Arthur Pratz | last post by:
Hi, Does anyone know about robot.txt? Do I really need one for my site? If so, how do I get it and what does it do for me? Thanks for your time, Mike Pratz http://www.chowardcompany.com
1
2601
by: nnobakht | last post by:
Hi, I'm working on an assignment for school which i am a bit stuck on. The assignment is to make robot which i have been given the library for move around different boards and collecting "coins" and avoiding "blocks" and not falling of the edge. The full assignment is outlined at http://www.cs.sfu.ca/CC/120/ggbaker/assign-1067/assign4 and the robot library is at http://www.cs.sfu.ca/CC/120/ggbaker/assign-1067/assign4-robot, i have written some...
0
1583
by: saptharishi123 | last post by:
please help me and anyone send vb code to control robot(back, front, right, left) using vb.and also to insert a video window to view video from tv tuner card,and if possible to show the status of parallel port pins. i am not good in vb so help me with full code plz....................... you could also mail me to <Removed by Moderator>. vinod
0
2428
by: Shiv Kumar | last post by:
Rational Robot is a complete set of components for automating the testing of Microsoft Windows client/server and Internet applications running under Windows NT 4.0, Windows XP, Windows 2000, and Windows 98. To learn about Rational Robot visit this http://test-techtools.blogspot.com/2007/06/introduction-to-rational-robot.html
11
3930
by: socialanxiety | last post by:
i hope someone here can help me. basically, me and my friend have a summer project. in this project, we need something that would basically function as a blender. we know we'll need to buy a motor that spins, but what we're having trouble with is figuring out how to program it. we want to be able to control the speed of the motor. how would we accomplish this? i'm new to all of this, so i'm having a hard time wrapping my mind
0
8121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8062
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8559
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8208
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6987
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4010
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4068
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.