RE: [PHP] how do you reference the previous field in a form?

From: Date: Mon, 27 Nov 2000 21:28:52 +0000
Subject: RE: [PHP] how do you reference the previous field in a form?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27472@lists.php.net to get a copy of this message
Thanks! =) That's exactly what I was looking for! =)
I would be predisposed to passing the info to the function as a second parameter, but that's just me.
Yes. That's what I'm doing right now, but there's enough fields in the form that keeping track of the field pairs became a job in itself. This relieves me from having to do that. Thanks =)
<script> <!-- function setValue(mod_from) {
        var num_elements = document.real.elements.length;
        for(i=0; i<num_elements; i++) {
                if(document.real.elements[i].name == mod_from.name) {
                        var prev_element = (i - 1);
                }
        }
        document.real.elements[prev_element].value = mod_from.value;
} //--> </script>


« previous php.general (#27472) next »