document.write with Accordion

document.write with Accordion

Thanks for taking the time to read my question. I'm not that great with javascript, but am able to do a few things after looking it up on line etc. What I'd like to do is when the user clicks on one of the bars for the accordion, I'd like to do a document.getElementById().value to set a value in a form. On my page under each accordion section I have a form. If the user clicks on, say, the second accordion bar, then I'd like to write a value to the form that is under that accordion bar. Is that possible? I've taken a look at jquery.ui.accordion.js but don't know where to put anything. For my page I've linked jquery-ui-1.8.4.custom.min.js
 
I hope I've provided enough information. Please let me know if further clarification is required.
 
Accordion Bar
      Form
Accordion Bar
       Form
             write a value in this form
Accordion Bar
      Form
 
Thanks again,
Brad