ginerjm Posted March 30, 2013 Share Posted March 30, 2013 I am trying to copy some input values from one form to another using the onclick event of my submit button. The submit button in the "receiving" form looks like: onclick="return copyChoice(this.form)" and my function to do this looks like: function copyChoice(frm) { var evt_val=''; var cb_plyr_sel_val =''; // inputs are 'evt' and 'cb_plyr_sel' if (document.getElementById('cb_plyr_sel').checked) { cb_plyr_sel_val = document.getElementById('cb_plyr_sel').value; } evt_val = document.getElementById("evt").value; // now copy the values to the hidden ones in this form ??? alert("values copyied?"); return True; } My problem is in the ??? area where I am trying to place the two values I've captured into the frm object that I have from the submit button. I have tried a couple of ways like this: frm.evt = evt_val; // where evt is the 'name' of the input in this form (frm) AND: var formid = frm.id; document.getElementById(formid).evt = evt_val; and neither of them worked. I know this since my alert at the end never arrives. So - given a form object, how do I reference the <input> tags within that form? The examples I've found (and tried to use here) don't seem to be working for me. Link to comment https://forums.phpfreaks.com/topic/276323-simple-js-confusion/ Share on other sites More sharing options...
ginerjm Posted March 30, 2013 Author Share Posted March 30, 2013 Once again - stupid typos !!**!! Was missing a quote on my name attrib for the dest field, causing function failure no matter what I tried. Link to comment https://forums.phpfreaks.com/topic/276323-simple-js-confusion/#findComment-1421958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.