piznac Posted May 4, 2006 Share Posted May 4, 2006 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 changedvar 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. Quote Link to comment https://forums.phpfreaks.com/topic/9065-adding-text-box-value-to-add-row/ Share on other sites More sharing options...
piznac Posted May 4, 2006 Author Share Posted May 4, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/9065-adding-text-box-value-to-add-row/#findComment-33348 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.