....but either way, the issue with your current script seems to be the
fact that you're not looping over the options array...you're looping
over the select element itself.
try:
// Get selected themes
for (i=0; i < document.frmImageAdm.lbxSelectedTheme.options.length; i++) {
On 5/16/05, Charlie Griefer <[EMAIL PROTECTED]> wrote:
> just out of curiousity...why not reference the 2nd list box directly
> rather than try and manipulate a hidden form field?
>
> On 5/16/05, Paul Henderson <[EMAIL PROTECTED]> wrote:
> > I'm trying to allow a user to select items from one listbox and add them to
> > a second list box, once the form is submitted the Javascript should set the
> > value of hdnThemes to all the items entered into the second list box
> > (lbxSelectedTheme), but of course that is not happening. Any ideas whats
> > wrong with the below code or do I need a new approach? Unfortunately since
> > taking over this project I have no way of reaching the orginal programmer
> > and my javascript skills need some major improvement!
> >
> > <form id="frmImage" name="frmImage" method="post"
> > ENCTYPE="multipart/form-data" action="addimge.cfm?Upload=Yes"
> > onSubmit="return VerifyData();">
> >
> > <input type="hidden" name="hdnThemes">
> >
> > <select name="lbxTheme" size=5>
> > OptionA
> > OptionB
> > OptionC
> > OptionD
> > OptionE
> > /select>
> >
> > <input type="button" name="btnThemeAdd" value="---->"
> > onClick="AddTheme();>
> > (The addTheme function is working fine, so I ommitted it to mimimize your
> > reading)
> >
> > <select name="lbxSelectedTheme" size=5>
> > <option value='-'>------------------------------------</option>
> > </select>
> >
> > <!----snippet from the VerifyData function that is called OnSubmit --->
> > // Get selected themes
> > for (i=1; i< document.frmImageAdm.lbxSelectedTheme.length; i++) {
> > if (vThemes == "") {
> > vThemes = document.frmImageAdm.lbxSelectedTheme.options[i].value
> > } else {
> > vThemes = vThemes + "," +
> > document.frmImageAdm.lbxSelectedTheme.options[i].value
> > }
> > }
> > document.frmImageAdm.hdnThemes.value = vThemes
> >
> > Looks like it should be fine, but when I reference Form.hdnThemes it is
> > still NULL?
> >
> > Thanks!
> > -Paul
> >
> >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206790
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54