User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 430,769 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,553 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 935 | Replies: 2
Reply
Join Date: Mar 2006
Posts: 8
Reputation: manish Kishore is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
manish Kishore manish Kishore is offline Offline
Newbie Poster

Need Help Urgently

  #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>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Need Help Urgently

  #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 5:33 pm.
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Need Help Urgently

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 5:07 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC