Add/Remove rows from Table

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

Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: Add/Remove rows from Table

 
0
  #31
Jul 7th, 2009
Originally Posted by sysel View Post
Hi,

I hope your code needs a minor repair only:
- somehow disappeared the <BODY> & <FORM ..> headings
<BODY><form method="post" action="./ThePage.php"> where ./ThePage.php should be overwritten with correct destination page name;
- the send() function was not extended:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function send(oForm)
  2. { var inpF = oForm.getElementsByTagName('input');
  3. for(i=0;i<inpF.length;i++) { inpF[i].disabled=false; }
  4. var inpF = oForm.getElementsByTagName('select');
  5. for(i=0;i<inpF.length;i++) { inpF[i].disabled=false; }
  6. oForm.submit();
  7. }
- a cosmetic cleaning could be:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. var selN = oRow.nextSibling.getElementsByTagName('select')[0];
  2. selN.selectedIndex=0;
in add(oRow)

- the <TABLE> ... </TABLE> definitely MUST be unformated in the code -> written as one single row, because, each [formating | invisible] character as spaces, tabs, and end of line can brake the structure of the DOM (Document Object Model) inserting the unwanted #text elements, hence the relative reference of the type: oElement.parentNode.nextSibling.firstChild reffers to the invisible character instead of the next <INPUT> box.

It is highly recommended to use frequently in FireFox the Error console (or whatever it has English name) and the DOM Inspector (available as free FF plugin). Lot of people use the FireBug plugin for direct debugging of the JavaScript code.

The database exploit seems to be well coded I hope it makes no problems.

I must again admit, that the styled document looks much better than the 'technical' skeleton only :-)

Sir i want to disable the textbox also.. if first textbox is filled then second textbox got disabled...vice versa..
I know i have to make changes in emtryStr() but i didnt find the right way..!!!

Help me out
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: Add/Remove rows from Table

 
0
  #32
Jul 9th, 2009
thnx to God and Sysel..
Finally i have done.. what i want..!!!

Dom is very Complex and Confusing..!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 49
Reputation: sysel is an unknown quantity at this point 
Solved Threads: 3
sysel sysel is offline Offline
Light Poster

Re: Add/Remove rows from Table

 
0
  #33
Jul 9th, 2009
Hi, I had no chance to write long posts, neither to test the script modification, while iPhone does not offer JavaScript IDE of any kind :-)
But I do not fully understand the last request - to disable unused text field. I can understand the motivation but not the goal. Credit and debet are mathematicaly nubers of the same kind hence it could be more correct to use only one text (number) input field and specify by math sign + or - if the amount is to be added or subtracted.
If two field for separated credit/debet input is used it may be checked that only one is filled in and consequently block the continue of any kind, but disable is not the good idea, because it inhibits the possibility of editing. Yes, one can delete the whole line, and add a new one. But it sounds me much more contraproductive.

Please, try to think over the whole process, and draw yourself the diagrams with data flow and realation between the routines and pages.

I can show you some tricks and examples but the analyses and code it is your deal.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: Add/Remove rows from Table

 
0
  #34
Jul 9th, 2009
Originally Posted by sysel View Post
Hi, I had no chance to write long posts, neither to test the script modification, while iPhone does not offer JavaScript IDE of any kind :-)
But I do not fully understand the last request - to disable unused text field. I can understand the motivation but not the goal. Credit and debet are mathematicaly nubers of the same kind hence it could be more correct to use only one text (number) input field and specify by math sign + or - if the amount is to be added or subtracted.
If two field for separated credit/debet input is used it may be checked that only one is filled in and consequently block the continue of any kind, but disable is not the good idea, because it inhibits the possibility of editing. Yes, one can delete the whole line, and add a new one. But it sounds me much more contraproductive.

Please, try to think over the whole process, and draw yourself the diagrams with data flow and realation between the routines and pages.

I can show you some tricks and examples but the analyses and code it is your deal.
Debit and Credit are accounting terms and i m making web application just like telly software(popular accounting software)...!!!

if debit is filled with values then Credit must be blank and if credit is filled then Debit must be Blank...!!!and the Total of debit and Credit must be equal before Process...!!!

I have done with all the changes...Big Big Thankx to You....!!!
now i can enter one values at a time...!! if one is filled other is disabled..!

but i found javascript DOM very complicated still few things is unclear to me....!!!!

Even if i write
<td></td><td></td>

into this way

<td></td>
<td></td>

this create problem in structure..!!! :O
quiet weird..huh..!!
Last edited by nish123; Jul 9th, 2009 at 8:13 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 49
Reputation: sysel is an unknown quantity at this point 
Solved Threads: 3
sysel sysel is offline Offline
Light Poster

Re: Add/Remove rows from Table

 
1
  #35
Jul 9th, 2009
Quit correct - the character <EOL> (End of Line) whatever code it is, ads an additional #text element between the table cells, what means that two consequent cells are not further the neighbors hence this.nextSibling does not reffer to the next cell, but the <EOL> char.

I do not argue against the financial terminology but try to propose some other view: if one input field is accompanied with an e.g. checkbox named "debet", if checked the input field could get red background and if necessary you may collect all white and red input fields separately, either you can add those white and subtract those red backrounded fields and the balance is clear if the result is zero :-) (or red if negative number)
It depends also who is the user of such page. The majority of avarage people better accept the word "pay" vs. "get" :-)

I met with the medicine doctor who need to use the word "diadynamic" current instead of direct or rectified current :-)
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: Add/Remove rows from Table

 
0
  #36
Jul 9th, 2009
I will Surely give a try to your proposal...!! but seniors want it in that way only... and now they are suggesting to use Autocomplete or Autosuggest in place of Dropdown..!!!!

means another text box instead of Select...!!!

  1. oRow.parentNode.replaceChild(oRow.cloneNode(true),oRow.parentNode.insertRow(oRow.rowIndex+1));

What this code exactly do.. kindly clear my doubt..!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 49
Reputation: sysel is an unknown quantity at this point 
Solved Threads: 3
sysel sysel is offline Offline
Light Poster

Re: Add/Remove rows from Table

 
0
  #37
Jul 10th, 2009
oRow.parentNode.replaceChild(oRow.cloneNode(true),oRow.parentNode.insertRow(oRow.rowIndex+1));

// is in one step the same as:

var oInsertedRow = oRow.parentNode.insertRow(oRow.rowIndex+1); // insert new row after oRow
var oCloneOfThisRow = oRow.cloneNode(true); // create copy of row Element subelements included (true)
oRow.parentNode.replaceChild(oCloneOfThisRow,oInsertedRow); // change the new but empty row with the row clone

With Autocomplete and Autosuggest you have better to learn Ajax and jQuery a bit. The task is so complex, and it is better to accept debugged portion of code :-)
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: Add/Remove rows from Table

 
0
  #38
Jul 11th, 2009
Thank u Sir...!!!
Finally i got that how this function works...!!!

Yeah i m working Autocomplete...
but first of all i have to remove select dropdown and commands related to it...!!! and in place of slect i have to use Input type...

That means i have to make changes in whole code...!!! becoz now there will be 5 input types..!!

Thanks once again..!!
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