Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Double combo drop down list working within a .tpl page?

    I posted before about doing a double combo drop down list in my phpBB forum. I put the javascript code within a .TPL page but the load function does not work. I tested the code on its own and it works fine. Below is the profile_add_body.tpl page where the code is supposed to go on. The forum itself im using is all PHP but the code goes on the .tpl page wich displays the current template. I was told to close the PHP tags before adding the javascript code but there are none. Can anyone please help me get the javascript load function to work properly on this page


    the javascript code is in red below



    Code:

    <form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post">

    {ERROR_BOX}

    <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
    <tr>
    <td align="left"><span class="nav"><a href="{U_INDEX}" class="nav"></a></span></td>
    </tr>
    </table>

    <table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
    <tr>
    <th class="thHead" colspan="2" height="25" valign="middle">{L_REGISTRATION_INFO}</th>
    </tr>
    <tr>
    <td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
    </tr>
    <!-- BEGIN switch_namechange_disallowed -->
    <tr>
    <td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
    <td class="row2"><input type="hidden" name="username" value="{USERNAME}" /><span class="gen"><b>{USERNAME}</b></span></td>
    </tr>
    <!-- END switch_namechange_disallowed -->
    <!-- BEGIN switch_namechange_allowed -->
    <tr>
    <td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
    <td class="row2"><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="{USERNAME}" /></td>
    </tr>
    <!-- END switch_namechange_allowed -->
    <tr>
    <td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>
    <td class="row2"><input type="text" class="post" style="width:200px" name="email" size="25" maxlength="255" value="{EMAIL}" /></td>
    </tr>
    <!-- BEGIN switch_edit_profile -->
    <tr>
    <td class="row1"><span class="gen">{L_CURRENT_PASSWORD}: *</span><br />
    <span class="gensmall">{L_CONFIRM_PASSWORD_EXPLAIN}</span></td>
    <td class="row2">
    <input type="password" class="post" style="width: 200px" name="cur_password" size="25" maxlength="32" value="{CUR_PASSWORD}" />
    </td>
    </tr>
    <!-- END switch_edit_profile -->
    <tr>
    <td class="row1"><span class="gen">{L_NEW_PASSWORD}: *</span><br />
    <span class="gensmall">{L_PASSWORD_IF_CHANGED}</span></td>
    <td class="row2">
    <input type="password" class="post" style="width: 200px" name="new_password" size="25" maxlength="32" value="{NEW_PASSWORD}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_CONFIRM_PASSWORD}: * </span><br />
    <span class="gensmall">{L_PASSWORD_CONFIRM_IF_CHANGED}</span></td>
    <td class="row2">
    <input type="password" class="post" style="width: 200px" name="password_confirm" size="25" maxlength="32" value="{PASSWORD_CONFIRM}" />
    </td>
    </tr>
    <!-- BEGIN switch_validation -->
    <tr>
    <td class="catSides" colspan="2" height="28"> </td>
    </tr>
    <tr>
    <th class="thSides" colspan="2" height="12" valign="middle">{L_VALIDATION}</th>
    </tr>
    <tr>
    <td class="row1" valign="top"><span class="gen">{L_VALIDATION}:<br /></span><span class="gensmall">{L_VALIDATION_EXPLAIN}</span></td>
    <td class="row2" align="center"><span class="gen"><img src="{S_ANTI_ROBOT1}" alt="" border="0"><img src="{S_ANTI_ROBOT2}" alt="" border="0"><img src="{S_ANTI_ROBOT3}" alt="" border="0"><img src="{S_ANTI_ROBOT4}" alt="" border="0"><img src="{S_ANTI_ROBOT5}" alt="" border="0"><br /><br /><input type="text" name="reg_key" maxlength="5" size="6"></span></td>
    </tr>
    <!-- END switch_validation -->
    <!-- Visual Confirmation -->
    <!-- BEGIN switch_confirm -->
    <tr>
    <td class="row1" colspan="2" align="center"><span class="gensmall">{L_CONFIRM_CODE_IMPAIRED}</span><br /><br />{CONFIRM_IMG}<br /><br /></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_CONFIRM_CODE}: * </span><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td>
    <td class="row2"><input type="text" class="post" style="width: 200px" name="confirm_code" size="6" maxlength="6" value="" /></td>
    </tr>
    <!-- END switch_confirm -->
    <tr>
    <td class="catSides" colspan="2" height="28"> </td>
    </tr>
    <tr>
    <th class="thSides" colspan="2" height="25" valign="middle">{L_PROFILE_INFO}</th>
    </tr>
    <tr>
    <td class="row2" colspan="2"><span class="gensmall">{L_PROFILE_INFO_NOTICE}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_ICQ_NUMBER}:</span></td>
    <td class="row2">
    <input type="text" name="icq" class="post"style="width: 100px" size="10" maxlength="15" value="{ICQ}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_AIM}:</span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 150px" name="aim" size="20" maxlength="255" value="{AIM}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_MESSENGER}:</span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 150px" name="msn" size="20" maxlength="255" value="{MSN}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_YAHOO}:</span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 150px" name="yim" size="20" maxlength="255" value="{YIM}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_REALNAME}: </span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 200px" name="realname" size="25" maxlength="50" value="{REALNAME}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_GENDER}:</span></td>
    <td class="row2">
    <input type="radio" {LOCK_GENDER} name="gender" value="0" {GENDER_NO_SPECIFY_CHECKED}/>
    <span class="gen">{L_GENDER_NOT_SPECIFY}</span>
    <input type="radio" name="gender" value="1" {GENDER_MALE_CHECKED}/>
    <span class="gen">{L_GENDER_MALE}</span>
    <input type="radio" name="gender" value="2" {GENDER_FEMALE_CHECKED}/>
    <span class="gen">{L_GENDER_FEMALE}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_BIRTHDAY}:{BIRTHDAY_REQUIRED}</span></td>
    <td class="row2"><span class="gensmall">{S_BIRTHDAY}</span></td>
    </tr>
    <tr>
    <td class="row1" width="38%"><span class="gen">{L_TESTING}:</span></td>
    <td class="row2">
    <form name="doublecombo">
    <p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
    <option>Technology Sites</option>
    <option>News Sites</option>
    <option>Search Engines</option>
    </select>
    <select name="stage2" size="1">
    <option>JavaScript Kit</option>
    <option>News.com</option>
    <option>Wired News</option>
    </select>

    </p>

    <script>

    /*
    Double Combo Script Credit
    By JavaScript Kit (www.javascriptkit.com)
    Over 200+ free JavaScripts here!
    */

    var groups=document.doublecombo.example.options.length
    var group=new Array(groups)
    for (i=0; i<groups; i++)
    group[i]=new Array()

    group[0][0]=new Option("JavaScript Kit")
    group[0][1]=new Option("News.com")
    group[0][2]=new Option("Wired News")

    group[1][0]=new Option("CNN")
    group[1][1]=new Option("ABC News")

    group[2][0]=new Option("Hotbot")
    group[2][1]=new Option("Infoseek")
    group[2][2]=new Option("Excite")
    group[2][3]=new Option("Lycos")

    var temp=document.doublecombo.stage2

    function redirect(x){
    for (m=temp.options.length-1;m>0;m--)
    temp.options[m]=null
    for (i=0;i<group[x].length;i++){
    temp.options[i]=new Option(group[x][i].text,group[x][i].value)
    }
    temp.options[0].selected=true
    }

    function go(){
    location=temp.options[temp.selectedIndex].value
    }

    </script>

    </form>

    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_LOCATION}:</span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 200px" name="location" size="25" maxlength="100" value="{LOCATION}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_OCCUPATION}:</span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 200px" name="occupation" size="25" maxlength="100" value="{OCCUPATION}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_INTERESTS}:</span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 200px" name="interests" size="35" maxlength="150" value="{INTERESTS}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
    <td class="row2">
    <input type="text" class="post"style="width: 200px" name="website" size="25" maxlength="255" value="{WEBSITE}" />
    </td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_SIGNATURE}:</span><br /><span class="gensmall">{L_SIGNATURE_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
    <td class="row2">
    <textarea name="signature"style="width: 300px" rows="6" cols="30" class="post">{SIGNATURE}</text>
    </td>
    </tr>
    <tr>
    <td class="catSides" colspan="2" height="28"> </td>
    </tr>
    <tr>
    <th class="thSides" colspan="2" height="25" valign="middle">{L_PREFERENCES}</th>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_PUBLIC_VIEW_EMAIL}:</span></td>
    <td class="row2">
    <input type="radio" name="viewemail" value="1" {VIEW_EMAIL_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="viewemail" value="0" {VIEW_EMAIL_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_HIDE_USER}:</span></td>
    <td class="row2">
    <input type="radio" name="hideonline" value="1" {HIDE_USER_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="hideonline" value="0" {HIDE_USER_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_NOTIFY_ON_REPLY}:</span><br />
    <span class="gensmall">{L_NOTIFY_ON_REPLY_EXPLAIN}</span></td>
    <td class="row2">
    <input type="radio" name="notifyreply" value="1" {NOTIFY_REPLY_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="notifyreply" value="0" {NOTIFY_REPLY_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_NOTIFY_ON_PRIVMSG}:</span></td>
    <td class="row2">
    <input type="radio" name="notifypm" value="1" {NOTIFY_PM_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="notifypm" value="0" {NOTIFY_PM_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_POPUP_ON_PRIVMSG}:</span><br /><span class="gensmall">{L_POPUP_ON_PRIVMSG_EXPLAIN}</span></td>
    <td class="row2">
    <input type="radio" name="popup_pm" value="1" {POPUP_PM_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="popup_pm" value="0" {POPUP_PM_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_ALWAYS_ADD_SIGNATURE}:</span></td>
    <td class="row2">
    <input type="radio" name="attachsig" value="1" {ALWAYS_ADD_SIGNATURE_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="attachsig" value="0" {ALWAYS_ADD_SIGNATURE_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_ALWAYS_ALLOW_BBCODE}:</span></td>
    <td class="row2">
    <input type="radio" name="allowbbcode" value="1" {ALWAYS_ALLOW_BBCODE_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="allowbbcode" value="0" {ALWAYS_ALLOW_BBCODE_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_ALWAYS_ALLOW_HTML}:</span></td>
    <td class="row2">
    <input type="radio" name="allowhtml" value="1" {ALWAYS_ALLOW_HTML_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="allowhtml" value="0" {ALWAYS_ALLOW_HTML_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_ALWAYS_ALLOW_SMILIES}:</span></td>
    <td class="row2">
    <input type="radio" name="allowsmilies" value="1" {ALWAYS_ALLOW_SMILIES_YES} />
    <span class="gen">{L_YES}</span>
    <input type="radio" name="allowsmilies" value="0" {ALWAYS_ALLOW_SMILIES_NO} />
    <span class="gen">{L_NO}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_BOARD_LANGUAGE}:</span></td>
    <td class="row2"><span class="gensmall">{LANGUAGE_SELECT}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_BOARD_STYLE}:</span></td>
    <td class="row2"><span class="gensmall">{STYLE_SELECT}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_TIMEZONE}:</span></td>
    <td class="row2"><span class="gensmall">{TIMEZONE_SELECT}</span></td>
    </tr>
    <tr>
    <td class="row1"><span class="gen">{L_DATE_FORMAT}:</span></td>
    <td class="row2"><span class="gensmall">{DATE_FORMAT_SELECT}</span></td>
    </tr>
    <!-- BEGIN switch_avatar_block -->
    <tr>
    <td class="catSides" colspan="2" height="28"> </td>
    </tr>
    <tr>
    <th class="thSides" colspan="2" height="12" valign="middle">{L_AVATAR_PANEL}</th>
    </tr>
    <tr>
    <td class="row1" colspan="2"><table width="70%" cellspacing="2" cellpadding="0" border="0" align="center">
    <tr>
    <td width="65%"><span class="gensmall">{L_AVATAR_EXPLAIN}</span></td>
    <td align="center"><span class="gensmall">{L_CURRENT_IMAGE}</span><br />{AVATAR}<br /><input type="checkbox" name="avatardel" /> <span class="gensmall">{L_DELETE_AVATAR}</span></td>
    </tr>
    </table></td>
    </tr>
    <!-- BEGIN switch_avatar_local_upload -->
    <tr>
    <td class="row1"><span class="gen">{L_UPLOAD_AVATAR_FILE}:</span></td>
    <td class="row2"><input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_SIZE}" /><input type="file" name="avatar" class="post" style="width:200px" /></td>
    </tr>
    <!-- END switch_avatar_local_upload -->
    <!-- BEGIN switch_avatar_remote_upload -->
    <tr>
    <td class="row1"><span class="gen">{L_UPLOAD_AVATAR_URL}:</span><br /><span class="gensmall">{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></td>
    <td class="row2"><input type="text" name="avatarurl" size="40" class="post" style="width:200px" /></td>
    </tr>
    <!-- END switch_avatar_remote_upload -->
    <!-- BEGIN switch_avatar_remote_link -->
    <tr>
    <td class="row1"><span class="gen">{L_LINK_REMOTE_AVATAR}:</span><br /><span class="gensmall">{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></td>
    <td class="row2"><input type="text" name="avatarremoteurl" size="40" class="post" style="width:200px" /></td>
    </tr>
    <!-- END switch_avatar_remote_link -->
    <!-- BEGIN switch_avatar_local_gallery -->

    <tr>
    <td class="row1"><span class="gen">{L_AVATAR_GALLERY}:</span></td>
    <td class="row2"><input type="submit" name="avatargallery" value="{L_SHOW_GALLERY}" class="liteoption" /></td>
    </tr>
    <!-- END switch_avatar_local_gallery -->
    <!-- END switch_avatar_block -->
    <tr>
    <td class="catBottom" colspan="2" align="center" height="28">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" /> <input type="reset" value="{L_RESET}" name="reset" class="liteoption" /></td>
    </tr>
    </table>

    </form>

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, but you did not post any description of the errors you try to get rid of. What exactly goes wrong, and what was expected?

    Besides, your question will be hard to answer without intimate knowledge of phpBB (if that's what's responsible for the bug). It's kinda hard to emulate the environment to try out your sample code - I would have to download phpBB, get accustomed to their template engine, yadda yadda... maybe this question would be better suited on the phpBB mod forums.

    I could imagine that the curly braces ({) get somehow mixed up with the template markers phpBB uses, but what do I know...
    De gustibus non est disputandum.

  • #3
    New Coder
    Join Date
    Oct 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I already said what the error is. The load function does not work that is all. I choose a category from drop down menu 1 and the sub categories do not load in the second one and I do not know why. I was wondering if I need to add a javascript header or do what I am not used to working with .TPL pages and i'm bad with javascript. No one answers any of my posts in the phpBB boards thats why i came here

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, but if javascript functions don't work correctly they usually issue an error message. Have you got error messages enabled? Just asking to be sure it's not something obvious.

    I inserted the script you used in one phpBB page and it all worked as expected...

    Which template file did you try to modify (I really don't know phpBB that intimately, and am to lazy to search)?
    De gustibus non est disputandum.

  • #5
    New Coder
    Join Date
    Oct 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have error messages enabled but the server is probably reading it as 2 different select menues. The function is not working. WELL I did actually get the function to work one time by closing the </form> tag and starting a new <form> right above that script. Then opening another <form></form> for the remainder of the script. Only then did the function work the way it was supposed to but when I submitted the script the options selected did not save so I really don't know what to do anymore and I NEED this function in my site. Maybe there is a way to do this in PHP but I can't find a way. Oh and I am adding this script to profile_add_body.tpl

  • #6
    New Coder
    Join Date
    Oct 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I finally have the function working but the information is not being saved and transfered to the user profile when i click submit


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •