473,698 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript function saveText() needs to Update the Perl array@BO_FO_EMA IL

My first time posting to clj , I have already read
http://jibbering.com/faq/#FAQ2_3 before posting.

javascript function in question:

saveText() is as follows:

function saveText( scroll_list, t_area, listToBeUpdated ) {
alert( listToBeUpdated .name );
// need to know which list to add the value in textarea back into
for(var i = 0; i < scroll_list.opt ions.length; i++) {
if( scroll_list.opt ions[i].selected == true ) {
scroll_list.opt ions[i].text = t_area.value;
break;
}
}
// push new value to the corresponding scrolling_list
// then use this scrolling_list to update the dummylist
if ( listToBeUpdated .name == "bo_fo_emai ls" ) {
// push ( \@BO_FO_EMAILS, t_area.value );
}
}

The webpage is produced with the following Perl code:
print $query->td(
$query->textarea(-name=>'BOFOEmai ls',
-onChange=>"save Text( this.form.bo_fo _emails,
this.form.BOFOE mails,
this.form.bo_fo _emails )"),
$query->p,
$query->button(-name=>'ADD',
-value=>'Confirm Modifications',
-onClick=>"move( index, this.form.BOFOE mails,
this.form.bo_fo _emails)"),
$query->button(-name=>'REMOVE',
-value=>'Edit Selected Entry',
-onClick=>"edit( this.form.bo_fo _emails,
this.form.BOFOE mails)"));

Basically, I am trying to remove scroll_list.opt ions[i].text from
@BO_FO_EMAILS and replace it with t_area.value.

Order of elements does matter in BO_FO_EMails. ie.
scroll_list.opt ions[i].text must be in the same relative position as
t_area.value in @BO_FO_EMAILS.
Problem:
push ( \@BO_FO_EMAILS, t_area.value );

gives a javascript error "Error on Page". How do I update @BO_FO_EMAILS
within the javascript function saveText()?

Jan 20 '06 #1
4 1437
On Fri, 20 Jan 2006, Lee wrote:
William said:

My first time posting to clj , I have already read
http://jibbering.com/faq/#FAQ2_3 before posting.

javascript function in question:

saveText() is as follows:

function saveText( scroll_list, t_area, listToBeUpdated ) {
alert( listToBeUpdated .name );
// need to know which list to add the value in textarea back into
for(var i = 0; i < scroll_list.opt ions.length; i++) {
if( scroll_list.opt ions[i].selected == true ) {
scroll_list.opt ions[i].text = t_area.value;
break;
}
}
// push new value to the corresponding scrolling_list
// then use this scrolling_list to update the dummylist
if ( listToBeUpdated .name == "bo_fo_emai ls" ) {
// push ( \@BO_FO_EMAILS, t_area.value );
}
}
Problem:
push ( \@BO_FO_EMAILS, t_area.value );

gives a javascript error "Error on Page". How do I update @BO_FO_EMAILS
within the javascript function saveText()?


4. Your Perl code runs on the server, exits (typically), and then
the page is sent to the client computer where the browser
displays it and the user makes a selection. @BO_FO_EMAILS
doesn't exist at the time that they make a selection.


I hear that by the time I run my javascript, the perl script had already
existed. but the question becomes how do I update a server-side file with
the newest values retrieved by the javascript?

Jan 20 '06 #2

William wrote:
On Fri, 20 Jan 2006, Lee wrote:
4. Your Perl code runs on the server, exits (typically), and then
the page is sent to the client computer where the browser
displays it and the user makes a selection. @BO_FO_EMAILS
doesn't exist at the time that they make a selection.


I hear that by the time I run my javascript, the perl script had already
existed. but the question becomes how do I update a server-side file with
the newest values retrieved by the javascript?


You'll need to generate a new request from the client to the server
carrying your data, and then have the server-side script process it in
whatever way you need. Try researching XMLHttpRequest.

-- David

Jan 20 '06 #3
On Mon, 23 Jan 2006, William wrote:
On Fri, 20 Jan 2006, David Wahler wrote:

William wrote:
On Fri, 20 Jan 2006, Lee wrote:
4. Your Perl code runs on the server, exits (typically), and then
the page is sent to the client computer where the browser
displays it and the user makes a selection. @BO_FO_EMAILS
doesn't exist at the time that they make a selection.

I hear that by the time I run my javascript, the perl script had already
existed. but the question becomes how do I update a server-side file with
the newest values retrieved by the javascript?
You'll need to generate a new request from the client to the server
carrying your data, and then have the server-side script process it in
whatever way you need. Try researching XMLHttpRequest.


I am currently using XMLHttpRequest as follows:
function saveText( scroll_list, t_area, listToBeUpdated ) {
var updated = new Option();
updated.value = t_area.value;
updated.text = t_area.text;
for(var i = 0; i < scroll_list.opt ions.length; i++) {
if( scroll_list.opt ions[i].selected ) {
scroll_list.opt ions[scroll_list.sel ectedIndex].text =
updated.value;
scroll_list.opt ions[scroll_list.sel ectedIndex].value=
updated.value;
break;
}
}
var confirmReq;
var url = "http://mkmxg00/cgi/confirmUpload.p l";
confirmReq = new ActiveXObject( "Microsoft.XMLH TTP" );
confirmReq.onre adystatechange = processReqChang e;
confirmReq.open ( "POST", url, true );
confirmReq.send ( "" );

alert( url );
}

function processReqChang e() {
if ( confirmReq.read yState == 4 ) {
if ( confirmReq.stat us == 200 ) {
alert( "passed!" );
}
}
else {
alert( confirmReq.read yState + ", " + confirmReq.stat us );
}
}

Where http://mkmxg00/cgi/confirmUpload.pl is as follows:
#!/usr/bin/perl -w

#============== =============== =============== =============== =============== =====
# confirmUpload.p l
# once the user clicks "Confirm Modifications", this script picks up the
form's
# newest data from STDIN (POST method), then saves it to the dummylist
#============== =============== =============== =============== =============== =====

use CGI;
use CGI::Carp qw(fatalsToBrow ser);

my $query = new CGI;

# add code that reads in the "Confirm Modifications" request from the CGI
buffer
my $buffer;
read ( STDIN, $buffer, $ENV{'CONTENT_L ENGTH'} );

# buffer now contains data to be written to the dummylist
open ( OUTFD, "/mkapp/webapps/mxrt/data/extra_desk_tick ers.txt" ) or


The above line should read:
open ( OUTFD, ">/mkapp/webapps/mxrt/data/extra_desk_tick ers.txt" ) or
error("Couldn't open file: $DATAFILE\n");

But the same problem remained. any help is appreciated.
error("Couldn't open file: $DATAFILE\n");
print ( OUTFD $buffer );
close ( OUTFD );

exit 0;
My problem: nothing is written to
/mkapp/webapps/mxrt/data/extra_desk_tick ers.txt

I have already invoked confirmUpload.p l with the XMLHttpRequest confirmReq (I
am using IE 6.0 on Windows XP). Why does the file contains no output from
the CGI buffer?

Jan 23 '06 #4
On Fri, 20 Jan 2006, David Wahler wrote:

William wrote:
On Fri, 20 Jan 2006, Lee wrote:
4. Your Perl code runs on the server, exits (typically), and then
the page is sent to the client computer where the browser
displays it and the user makes a selection. @BO_FO_EMAILS
doesn't exist at the time that they make a selection.


I hear that by the time I run my javascript, the perl script had already
existed. but the question becomes how do I update a server-side file with
the newest values retrieved by the javascript?


You'll need to generate a new request from the client to the server
carrying your data, and then have the server-side script process it in
whatever way you need. Try researching XMLHttpRequest.


I am currently using XMLHttpRequest as follows:
function saveText( scroll_list, t_area, listToBeUpdated ) {
var updated = new Option();
updated.value = t_area.value;
updated.text = t_area.text;
for(var i = 0; i < scroll_list.opt ions.length; i++) {
if( scroll_list.opt ions[i].selected ) {
scroll_list.opt ions[scroll_list.sel ectedIndex].text = updated.value;
scroll_list.opt ions[scroll_list.sel ectedIndex].value= updated.value;
break;
}
}
var confirmReq;
var url = "http://mkmxg00/cgi/confirmUpload.p l";
confirmReq = new ActiveXObject( "Microsoft.XMLH TTP" );
confirmReq.onre adystatechange = processReqChang e;
confirmReq.open ( "POST", url, true );
confirmReq.send ( "" );

alert( url );
}

function processReqChang e() {
if ( confirmReq.read yState == 4 ) {
if ( confirmReq.stat us == 200 ) {
alert( "passed!" );
}
}
else {
alert( confirmReq.read yState + ", " + confirmReq.stat us );
}
}

Where http://mkmxg00/cgi/confirmUpload.pl is as follows:
#!/usr/bin/perl -w

#============== =============== =============== =============== =============== =====
# confirmUpload.p l
# once the user clicks "Confirm Modifications", this script picks up the form's
# newest data from STDIN (POST method), then saves it to the dummylist
#============== =============== =============== =============== =============== =====

use CGI;
use CGI::Carp qw(fatalsToBrow ser);

my $query = new CGI;

# add code that reads in the "Confirm Modifications" request from the CGI
buffer
my $buffer;
read ( STDIN, $buffer, $ENV{'CONTENT_L ENGTH'} );

# buffer now contains data to be written to the dummylist
open ( OUTFD, "/mkapp/webapps/mxrt/data/extra_desk_tick ers.txt" ) or
error("Couldn't open file: $DATAFILE\n");
print ( OUTFD $buffer );
close ( OUTFD );

exit 0;
My problem: nothing is written to
/mkapp/webapps/mxrt/data/extra_desk_tick ers.txt

I have already invoked confirmUpload.p l with the XMLHttpRequest confirmReq
(I am using IE 6.0 on Windows XP). Why does the file contains no output
from the CGI buffer?

Jan 23 '06 #5

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

Similar topics

2
12781
by: Obscurr | last post by:
i've got an array created in php that I want to send over to a javascript function. onclick = "return sjekk(<?echo $names; ?> )" in my "sjekk" function, when I try to print an alert : function sjekk(navn) { alert(navn); // or alert(navn) return(false);
7
21343
by: NotGiven | last post by:
I have a field called telephone whose ONBLUR action is to call a javascript function: validatePhoneNumber(telephone) The non-working function is: function validatePhoneNumber(v) { var phone =document.form. + v + .value; //HERE"S WHAT IS NOT WORKING
4
10675
by: Steven | last post by:
Hello, I have 3 files -- 1. mainform.aspx 2. mainform.aspx.cs 3. mouse.js mainform.aspx contains a image button ("zoominimgbut") which will exceute C# code, whenever the user clicks on it. mainform.aspx.cs is the code behind for mainform.aspx. Mouse.js contains javascript code which needs to executed
5
1706
by: mk | last post by:
Greetings all - im new to this newsgroup so pls dont flame me :p I need some help! Please view the html below in a browser. Or goto this url -http://firebrain.co.uk/java-problem.htm (Assuming you have seen the rendered code) Basically I need the X buttons to change all the values of each textbox to zero either in the col or row depending on which button is clicked. Function summery: If you click on a X button on the right hand side of...
1
7698
by: vocalise | last post by:
The title probably isn't very clear, but I haven't been able to find this problem (or I must be having problems figuring out which search strings to use) so I apologize if this has been addressed before, and I apologize if this is the wrong forum since I'm trying to use the XMLHTTPRequest with Javascript and PHP and I couldn't figure out which category my problem belonged to. I am completely new to AJAX and rusty with Javascript. I created a...
0
1220
by: kloppie | last post by:
Hi there, im using ASP.NET AJAX to update a GridView, using the UpdatePanel and the Timer. What I would like is to update a Label on the page with the last time of update. But it should be the time on the users computer and not the time on the server. Therefore i need to have a javascript function update the label for me, but i cant find a way to do this after the Timer Tick has occured.
2
4663
by: Anees | last post by:
Hi, i need to invoke a javascript function while clicking a button that is in a flash movie. i hav used geturl() to redirect the page to some other page. but is it possible to call a javascript function from FLASH..?? please help me Regards
10
6142
by: getmadhu | last post by:
Hi All, How can i pass a Perl var($val) as a parameter to a Javascript function. Please can any one help me out... ex: Perl Code ---------------- $var = 'sample'
3
2315
by: pinko1204 | last post by:
My Update function cannot successful update to sql table even don't have any error. Please help to check .....thx PHP1 <?php require_once 'header.php'; ?> <style type="text/css"> <!--
0
8683
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
9170
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...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7741
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
6531
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
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
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...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.