Jump to content

Adding text box "value' to add row


piznac

Recommended Posts

Ken,

Ok,..

With this javascript which we looked at yesterday:

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

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:

[code] 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']; ?>' [/code]

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

I also tried to add this script:

[code]<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>[/code]

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.