MikeDXUNL Posted August 12, 2007 Share Posted August 12, 2007 alright. this forum is to create a Category or Forum. The user selects Category or Forum from a drop-down list and then if it is equal to 'Category' the Forum Description textarea will disable... if it is equal to 'Forum'. then it is enabled. if there is an easier way of pulling this off, i would be thankful but here is the coding. createforum.php <form action="createforum.php" method="post"> <table width="50%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="25%" valign="top"><strong>Forum Type:</strong></td> <td width="75%"> <select name="forumtype" onchange="forumtype(this.value)"> <option value="no">----------------------</option> <option value="Category">Category</option> <option value="Forum">Forum</option> </select> <div id="txtHint"> </div> </td> </tr> <tr> <td valign="top"><strong>Forum Description:</strong></td> <td valign="top"> <textarea id="forumdesc" name="forumdesc" cols="30" rows="10"></textarea> </td> </tr> </table> <input type="submit" value="Submit" /> </form> js/forumtype.js var xmlHttp function forumtype(str) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="ajax/forumtype.php"; url=url+"?ftype="+str; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; if (xmlHttp.responseText == ' ') document.getElementById("forumdesc").disabled = true; else document.getElementById("forumdesc").disabled = false; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } ajax/forumtype.php <?php if ($_GET['ftype'] == "Category") { echo ""; } elseif($_GET['ftype'] == "Forum") { echo "hello world"; } ?> 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.