shanejeffery86 Posted January 15, 2009 Share Posted January 15, 2009 Hey all. I am using the Smoothbox/Mootools JS libraries for a project. Right now, I believe that I am just having a basic logic error, but it may be more than that. Also, I am using Smarty for my templating system and HTML handling. So, here is the issue. I am trying to hit a JS function when 'My Friends' is clicked. When the 'My Friends' is clicked, a Smoothbox window pops up and shows the data that I need it to show which is a couple of users' full names which are links. If you click on one of those name links, it is supposed to append that name to the already existing list of invitees. In essence, I need the name that is clicked on the Smoothbox window to be added to the "invitees" ID input box. TPL Code: <td class="input_label"><label for="invitees">Invitee(s): </label></td> <td><input type="text" id="invitees" name="invitees" value="{foreach from=$meetingUsers item=user} {if $user.meeting_owner eq 0 && $user.fullname neq ''}{$user.fullname}; {elseif $user.meeting_owner eq 0}{$user.email}; {/if}{/foreach}" size="44" tabindex="1"></input> <span style="padding-left: 20px;"><a href="" onClick="myFriendsList(); return false;">My Friends</a></span></td> The myFriendsList() function pops up the Smoothbox window that shows the user names. When one of those user names is clicked, the addToInviteeList() function is hit. JS code: function addToInviteeList(user_id, user_name) { var invitee_list = document.getElementById('invitees').value; var invitee_holder = document.getElementById('invitees'); invitee_holder.innerHTML = invitee_list + user_name + ';'; } I believe that I am correct in assuming that the invitee_holder innerHTML value should overwrite the current text that is in the 'invitees' ID input box. Is that correct? Because when I click one of the user names, I get no JS error in my error console and I do not get the input box to take on the correct values. Is it possible that the default value that is in there from Smarty is keeping the JS from running properly in the addToInviteeList() function? I apologize if this is a jumble of thoughts. I am just a little baffled as to what to do here. Thanks. Quote Link to comment Share on other sites More sharing options...
shanejeffery86 Posted January 15, 2009 Author Share Posted January 15, 2009 Also when I alert the 'invitee_holder.innerHTML', I get the following value in the popup: <input>username1; username2; username3; username4; 'username4' is the one that was just added one via the JS code. Quote Link to comment Share on other sites More sharing options...
shanejeffery86 Posted January 15, 2009 Author Share Posted January 15, 2009 Alright, I went from invitee_holder.innerHTML to invitee_holder.value and that the correct values minus the <input> tag. Now I just need to figure out how to actually populate that input box with the values that I have in invitee_holder. Quote Link to comment Share on other sites More sharing options...
shanejeffery86 Posted January 15, 2009 Author Share Posted January 15, 2009 HOORAY! Got it to work. Godforsaken documentation. People should be required to write up solid documentation before they are allowed to release JS libraries! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.