Jump to content


Photo

Adding text box "value' to add row


  • Please log in to reply
1 reply to this topic

#1 piznac

piznac
  • Members
  • PipPipPip
  • Advanced Member
  • 261 posts

Posted 04 May 2006 - 03:31 PM

Ken,

Ok,..

With this javascript which we looked at yesterday:

var cellRight = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'rm[]';
  el.id = 'rm' + iteration;
  el.size = 20;

Is there a way to add the value of the text box? i.e. If the first set of text boxes, and the first text box intial value was "<?php echo $row_ptopdalisting['rm']; ?>"

is there a way to duplicate that value when the user presses add row button?

I tried this:

var cellRight = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'rm[]';
  el.id = 'rm' + iteration;
  el.size = 20; 
  el.value = '<?php echo $row_ptopdalisting['rm']; ?>'

And the entire row does not repeat. Or the text boxes do not display.

I also tried to add this script:

<script language="JavaScript" type="text/javascript">
function autofill(){
var fieldvalue = document.getElementById('rm').value;

//define all of the fields that will be changed
var autofillfield = new Array()
autofillfield[0] = "rm1"

for(var i = 0; i <autofillfield.length; i++){
document.getElementById(autofillfield[i]).value = fieldvalue;
}
}
</script>

And I couldnt get it to work. Any insight on this one.

Now I know this is probably not PHP related and should be posted in the JS section. But this is where you have helped me before & I was hoping to catch you again.

#2 piznac

piznac
  • Members
  • PipPipPip
  • Advanced Member
  • 261 posts

Posted 04 May 2006 - 03:48 PM

Ok,..I guess this was moved and the title changed. And now it doesnt make much sense. The first srcipt is a "add row" script. Hope this helps




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users