Need Help Urgently

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Mar 2006
Posts: 8
Reputation: manish Kishore is an unknown quantity at this point 
Solved Threads: 0
manish Kishore manish Kishore is offline Offline
Newbie Poster

Need Help Urgently

 
0
  #1
Apr 17th, 2006
Hi All,
I am creating a html file where rows are being Genereated Dyanmically.
Now I want to pass the values of Input box to the perl File.
I am not able to send the values of row to the server side.

Can U please let me know Where I am facing the prob.

Thanks In advance.
perl File:
#!/usr/bin/perl
use strict;
use CGI;
my $q = new CGI;
print $q->header();
my $a = $q->param('txtRow');


print "This is A:- $a" ;
print "\n";





<html>
<head>
<title>Title of page</title>
</head>
<body>
<script type="text/javascript" >
function addRowToTable()
{
var tbl = document.getElementById('sample');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);

// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);

// right cell
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'txtRow' + iteration;
el.id = 'txtRow' + iteration;
el.size = 40;

el.onkeypress = keyPressTest;
cellRight.appendChild(el);

}

function keyPressTest(e, obj)
{
var validateChkb = document.getElementById('chkValidateOnKeyPress');
if (validateChkb.checked) {
var displayObj = document.getElementById('spanOutput');
var key;
if(window.event) {
key = window.event.keyCode;
}
else if(e.which) {
key = e.which;
}
var objId;
if (obj != null) {
objId = obj.id;
} else {
objId = this.id;
}
displayObj.innerHTML = objId + ' : ' + String.fromCharCode(key);
}
}
function validateRow(frm)
{
var chkb = document.getElementById('chkValidate');
if (chkb.checked) {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return;
}
}
}
}
</script>
</body>

<form name=fp action="Test3.pl" method=get>
<p>
<input type="button" value="Add" onclick = "addRowToTable();"/>
<input type="submit" value="Submit" onclick = " validateRow(this.form)"/>

</p>
<table border="1" id ="sample">
<tr>
<th colspan="3">Sample Table </th>
</tr>
<tr>
<td> 1</td>
<td><input type="text" name="textRow1" id="textRow1" size ="40" onkeypress = "keypressTest(event,this);"/ ></td>
</tr>
</table>
</form>


</html>
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Need Help Urgently

 
0
  #2
Apr 17th, 2006
This is about the 5th post you've made on this topic. I understand how frustating it can be when no one answers your question. There might be valid reasons why you don't get an answer. I, for example, don't know PERL, and I also tend to skim past messages with giant code listings.

Also, from what I can tell from your posts, this is an on-going project that has had several issues. A forum is best for getting answers to very specific issues. People don't like to get wrapped up in others' nightmares, if you know what I mean!

So my advice is to try to isolate a specifiic problem, research that problem, and if there are still questions, post a short message, with your simplified code section that illustrates the problem. You might get better answers that way.
Last edited by tgreer; Apr 17th, 2006 at 6:33 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Need Help Urgently

 
0
  #3
Apr 17th, 2006
Personally, I don't know how good of an idea it is to use a submit button with an onclick event. I could be wrong, and still living in earlier days, but I would use a button, with an onclick, and then do a form.submit(); to submit the form. The perl code looks fine (taken from a book, pretty much, but fine). A Debugging suggestion here, is to use alerts throughout your code, and walk through the page, line by line if necessary, with alerts in each code block. Alert the values of your variables or elements, and make sure that you are passing something other than blank or null information to the perl script.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC