Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Solution (http://www.programmingforums.org/showthread.php?t=989)

dnathe4th Oct 30th, 2004 10:54 AM

ok lets see if i can explain this well enough
:

cur_pil = document.first.person.value;
cur_fld = document.first.field.value;
hid_name = "$all[" + cur_pil + "][" + cur_fld + "]";
tablevals_answer = 'document.tablevals.' + hid_name + '.value;';
document.first.valuer.value = tablevals_answer;


I have a whole bunch of hidden inputs, all named after the array they got their values from. The array is "$all[][]" (becuase they're getting values from a PHP script). I want "document.first.valuer.value" to be the value of one of those hidden inputs. But I don't know how to get it to access teh ".value" attribute of the hidden input i want. I know the piece of script i have there is wrong, but what do I do to fix it?

tempest Oct 30th, 2004 11:02 PM

I need to see your HTML code to make this work... but you'll need to fill a JS array with the PHP array info..

:

<script type="text/javascript">
var all = array(
<?php
  foreach($all as $col => $val)
    echo "  \"{$col}\" => \"{$val}\"\n";
?>
);
</script>



All times are GMT -5. The time now is 9:13 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC