DJ24966 Posted November 17, 2008 Share Posted November 17, 2008 Ok, after getting the rest of my issues fixed thanks you guys, I was wondering if you could help out with 1 last thing. We have incorporated categories to our chat site to keep things organized. In the past, the user could just input the room name and join, no problem all worked well. Here is the code we used then. <b>Create a Chat:</b><br> <form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx"> <input type="hidden" name="member" value="XS803m"> Room: <input name="value" type="text"><br> <input type="submit" value="Create"> </form> No, how could I make the following. I need the category to show up directly after the channel.aspx, so, an example would be. http://chatterupchat.webhop.org/chat/channel.aspx?value=[GN]TheLobby&member=XS803m Here is the code I have no, which obviously, does not work <b>Create a Chat:</b><br> <form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx"> <input type="hidden" name="member" value="XS803m"> Room: <input name="value" type="text"><br> Category: <select name="cat"> <option value="[CP]">Computing</option> <option value="[EN]">Entertainment</option> <option value="[GN]">General</option> <option value="[iE]">Interests</option> <option value="[NP]">News & Politics</option> <option value="[RO]">Romance</option> <option value="[RE]">Religion</option> <option value="[PE]">Peers</option> <optoin value="[sP]">Sports & Recreation</option> <option value="[TE]">Teens</option> </select> <input type="submit" value="Create"> </form> Any help would be highly appreciated. Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/ Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 hidden field with name of value and the value of this field would be the cat name built and inserted into the value using javascript and an onclick or on submit event that starts the js funchion Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691711 Share on other sites More sharing options...
DJ24966 Posted November 17, 2008 Author Share Posted November 17, 2008 hmm, can't seem to get it to work, can someone show the code for me? Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691714 Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 i new you was hankering for someone to do it for you lol first change your form to to this <form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx"> <input type="hidden" name="member" value="XS803m"> Room: <input id="value" name="value" type="text"><br> Category: <select id="cat" name="cat"> <option value="[CP]">Computing</option> <option value="[EN]">Entertainment</option> <option value="[GN]">General</option> <option value="[iE]">Interests</option> <option value="[NP]">News & Politics</option> <option value="[RO]">Romance</option> <option value="[RE]">Religion</option> <option value="[PE]">Peers</option> <optoin value="[sP]">Sports & Recreation</option> <option value="[TE]">Teens</option> </select> <input type="submit" value="Create" onclick="buildCat()"> </form> put this is the head <script type="text/javascript"> <!-- function buildCat() { var selD = document.getElementById('cat'); var selI = selD.options[selD.selectedIndex].value; document.getElementById('value').value = selI; //--> </script> if computting was selected this will output http://chatterupchat.webhop.org/chat/channel.aspx?member=XS803m&value=[CP] Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691730 Share on other sites More sharing options...
DJ24966 Posted November 17, 2008 Author Share Posted November 17, 2008 See, I could have gotten it to do that, but thats not whats needed. I need the [CP] or whatever cat to appear infront of the room name, like this. http://chatterupchat.webhop.org/chat/channel.aspx?value=[GN]TheLobby&member=XS803m Otherwise, it will not place the channel into a category like I would like for it to. Sorry for the confusion Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691733 Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 use this script then <script type="text/javascript"> <!-- function buildCat() { var selD = document.getElementById('cat'); var selI = selD.options[selD.selectedIndex].value; var selT = selD.options[selD.selectedIndex].text; var buLi = selI+selT; document.getElementById('value').value = buLi; //--> </script> Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691736 Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 oh i see what you mean now <form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx"> <input type="hidden" name="member" value="XS803m" /> <input type="hidden" name="value" id="value" value="" /> Room: <input id="room" name="room" type="text"><br> Category: <select id="cat" name="cat"> <option value="[CP]">Computing</option> <option value="[EN]">Entertainment</option> <option value="[GN]">General</option> <option value="[iE]">Interests</option> <option value="[NP]">News & Politics</option> <option value="[RO]">Romance</option> <option value="[RE]">Religion</option> <option value="[PE]">Peers</option> <optoin value="[sP]">Sports & Recreation</option> <option value="[TE]">Teens</option> </select> <input type="submit" value="Create" onclick="buildCat()"> </form> <script type="text/javascript"> <!-- function buildCat() { var selD = document.getElementById('cat'); var selI = selD.options[selD.selectedIndex].value; var selT = document.getElementById('room').text; var buLi = selI+selT; document.getElementById('value').value = buLi; //--> </script> [/code Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691739 Share on other sites More sharing options...
DJ24966 Posted November 17, 2008 Author Share Posted November 17, 2008 hmm, both ways I'm still getting the same URL with the same results. http://chatterupchat.webhop.org/chat/channel.aspx?member=XS803m&value=&room=Test&cat=[iE] I've been having the same issue, everything I have tried resulted in that. When this is what I need it to look like. http://chatterupchat.webhop.org/chat/channel.aspx?value=[iE]Test&member=XS803m Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691743 Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 does it have to be in that order and does it matter is room= and cat= is there?? Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691745 Share on other sites More sharing options...
DJ24966 Posted November 17, 2008 Author Share Posted November 17, 2008 It has to look identical to the URL I posted or else you get an application error. http://chatterupchat.webhop.org/chat/channel.aspx?value=[GN]TheLobby&member=XS803m As you notice, that one will work fine, I'm just confused on how to get mine working. Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691751 Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 Well that funny on my part, i missed the final } in the javascript.. doh so try this as you JS <script type="text/javascript"> <!-- function buildCat() { var selD = document.getElementById('cat'); var selI = selD.options[selD.selectedIndex].value; var selT = document.getElementById('room').value; var buLi = selI+selT; document.getElementById('value').value = buLi; } //--> </script> and this as your form <form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx"> <input type="hidden" name="value" id="value" value="" /> <input type="hidden" name="member" value="XS803m" /> Room: <input id="room" type="text"><br> Category: <select id="cat"> <option value="[CP]">Computing</option> <option value="[EN]">Entertainment</option> <option value="[GN]">General</option> <option value="[iE]">Interests</option> <option value="[NP]">News & Politics</option> <option value="[RO]">Romance</option> <option value="[RE]">Religion</option> <option value="[PE]">Peers</option> <optoin value="[sP]">Sports & Recreation</option> <option value="[TE]">Teens</option> </select> <input type="submit" value="Create" onclick="buildCat()"> </form> Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691762 Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 also i noticed this <optoin value="[sP]">Sports & Recreation</option> should be <option value="[sP]">Sports & Recreation</option> Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691763 Share on other sites More sharing options...
DJ24966 Posted November 17, 2008 Author Share Posted November 17, 2008 Well that funny on my part, i missed the final } in the javascript.. doh so try this as you JS <script type="text/javascript"> <!-- function buildCat() { var selD = document.getElementById('cat'); var selI = selD.options[selD.selectedIndex].value; var selT = document.getElementById('room').value; var buLi = selI+selT; document.getElementById('value').value = buLi; } //--> </script> and this as your form <form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx"> <input type="hidden" name="value" id="value" value="" /> <input type="hidden" name="member" value="XS803m" /> Room: <input id="room" type="text"><br> Category: <select id="cat"> <option value="[CP]">Computing</option> <option value="[EN]">Entertainment</option> <option value="[GN]">General</option> <option value="[iE]">Interests</option> <option value="[NP]">News & Politics</option> <option value="[RO]">Romance</option> <option value="[RE]">Religion</option> <option value="[PE]">Peers</option> <optoin value="[sP]">Sports & Recreation</option> <option value="[TE]">Teens</option> </select> <input type="submit" value="Create" onclick="buildCat()"> </form> Thanks again, and yeah, I noticed that as well. All is working! Once I get everything done, I will include this site in the credits for helping us out. I really do appreciate it. Thank you! Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691764 Share on other sites More sharing options...
DJ24966 Posted November 17, 2008 Author Share Posted November 17, 2008 Is it possible to detect if the users Room name has a space in it, and have the code replace the space with an _? Thanks Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691903 Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 <script type="text/javascript"> <!-- function buildCat() { var selD = document.getElementById('cat'); var selI = selD.options[selD.selectedIndex].value; var selT = document.getElementById('room').value; var sRE = selT.replace(/ /g,"_"); var buLi = selI+sRE; document.getElementById('value').value = buLi; } //--> </script> Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691983 Share on other sites More sharing options...
DJ24966 Posted November 17, 2008 Author Share Posted November 17, 2008 <script type="text/javascript"> <!-- function buildCat() { var selD = document.getElementById('cat'); var selI = selD.options[selD.selectedIndex].value; var selT = document.getElementById('room').value; var sRE = selT.replace(/ /g,"_"); var buLi = selI+sRE; document.getElementById('value').value = buLi; } //--> </script> Awesome man, Thank you so much. I guess it was you who was in a room yesterday? I didn't have mine opened up, it was minimized and I didn't see it till last night. Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-692152 Share on other sites More sharing options...
laPistola Posted November 18, 2008 Share Posted November 18, 2008 yes after you reported my script not working i did it myself to test, thats when i saw the missing } Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-692930 Share on other sites More sharing options...
DJ24966 Posted November 18, 2008 Author Share Posted November 18, 2008 Well, again I appreciate it. Thanks Link to comment https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-692997 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.