If this gets started will you help?
Yes
 55%  [ 5 ]
No
 44%  [ 4 ]
Total Votes : 9

Might I also suggest making a recent reviews and files area.
Noted and that shouldn't be too hard.
noahbaby94 wrote:
Might I also suggest making a recent reviews and files area.
http://www.cemetech.net/archives/ not doing the trick for you? Smile
Another suggestion is to request a review.
noahbaby94 wrote:
Might I also suggest making a recent reviews and files area.


Latest reviews is now added.
I am currently trying to add a little bit of ajax to my site but I have run into a problem. Whenever i change the select field by adding on change i get an unexpected t_string error. The original field looks like this
Code:
<select name='article_cat' class='textbox' style='width:250px;'>
$catlist</select>


Whenever i change it to look like this

Code:
<select name='article_cat' class='textbox' style='width:250px;' onChange="getSubCat('subcat.php?

subcat='+this.value)">
$catlist</select>
I get the error. Does anyone know why it would be happening because the error is occurring about 50 lines down the page.
gimme a little bit of context on that code, but I have an idea as to why.
what kind of stuff do you need to know, the source file that i am modding is poorly commented so you would probably need the entire folder to understand it.
lafferjm wrote:
what kind of stuff do you need to know, the source file that i am modding is poorly commented so you would probably need the entire folder to understand it.


I would think that making readable comments would precede adding features...
I know it should, but i downloaded it as an addon and it took me about two hours to figure out what it was doing.

Alright I do not know ajax but here is my attempt at it, and it is not working. Can anyone please point out what i am doing wrong.

submit.php

Code:

         echo "<form name='submit_form' method='post' action='".FUSION_SELF."?stype=a' onsubmit='return validateArticle(this);'>\n";
         echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
         echo "<td width='100' class='tbl'>".$locale['521']."</td>\n";
         echo "<td class='tbl'><select onChange=\"getSub('findSub.php?sub='+this.value)\" name='article_cat' class='textbox'>\n$cat_list</select></td>\n";
         echo "</tr>\n<tr>\n";
         echo "<td>Subcategory:</td>";
         echo "<td><span id='subcat'><select name='subcat' class='textbox'>";
         echo "<option>Subcategory</option>";
         echo "</select></span></td>\n";
         echo "</tr>";
         echo "<tr>";
         echo "<td class='tbl'>".$locale['522']."</td>\n";
         echo "<td class='tbl'><input type='text' name='article_subject' value='$article_subject' maxlength='64' class='textbox' style='width:300px;' /></td>\n";
         echo "</tr>\n<tr>\n";
         echo "<td valign='top' class='tbl'>".$locale['523']."</td>\n";
         echo "<td class='tbl'><textarea name='article_snippet' cols='60' rows='3' class='textbox' style='width:300px;'>$article_snippet</textarea></td>\n";
         echo "</tr>\n<tr>\n";
         echo "<td valign='top' class='tbl'>".$locale['524']."</td>\n";
         echo "<td class='tbl'><textarea name='article_body' cols='60' rows='8' class='textbox' style='width:300px;'>$article_body</textarea></td>\n";
         echo "</tr>\n<tr>\n";
         echo "<td align='center' colspan='2' class='tbl'><br />\n";
         echo "<input type='checkbox' name='line_breaks' value='yes'".$breaks." />".$locale['525']."<br /><br />\n";
         echo "<input type='submit' name='preview_article' value='".$locale['526']."' class='button' />\n";
         echo "<input type='submit' name='submit_article' value='".$locale['527']."' class='button' />\n</td>\n";
         echo "</tr>\n</table>\n</form>\n";


selectfield.js

Code:

<script language="JavaScript" type="text/javascript">
function getSub(strURL){
   var req=getXMLHTTP()
   if(req) {
      req.onreadystatechange=function(){
         if(req.readyState==4){
         if(req.status==200){
            document.getElementById('subcat').innerHTML=req.responseText;
         }
         else{
            alert("There was a problem while using XMLHTTP:\n");
         }
      }
   }
req.open("GET",strURL,true);
req.send(null);
}
}
</script>


findSub.php

Code:

<?php
require_once "config.php";

$sub=$_GET['sub'];
$link = mysql_connect($db_host,$db_user);
if(!$link){
   die('Could not connect:'.mysql_error());
}
mysql_select_db($db_name);
$query1 = "SELECT article_cat_name FROM fusion_article_cats WHERE article_cat_parent=article_cat_id";
$result = mysql_query($query1);
echo "<select name = 'category'>";
echo "<option>Subcategory</option>";
while($row=mysql_fetch_array($result)){
   echo "<option value><?=$row['article_cat_name']</option>"
}
</select>
?>


edit: I think the problem is because when i am using the WHERE clause i need to compare two columns but it won't let me do it like that. Now i just need to figure out how to work around that.

edit2: After i googling for about an hour i think my query is going to have to look similar to this

Code:
SELECT *
FROM fusion_article_cats a, fusion_article_cats b
WHERE a.article_cat_id = b.article_cat_parent
As it turns out it wasn't the query but something else that i am overlooking. I also have to find a way to narrow my query because it returns all the results where the parent matches the child and not just the ones in the first select box. I should be able to solve that relatively easy though.
I have pretty much given up trying to do this myself. Has anyone tried any of the ones in the links or would they recommend one?

http://pear.php.net/package/HTML_AJAX/docs/latest/li_HTML_AJAX.html

http://ajaxpatterns.org/wiki/index.php?title=PHP_Ajax_Frameworks
My favorite for some low-level AJAX is prototype.js, which also has some various other very interesting functions.
That looks pretty cool i think i will try it out. I was trying to use xajax but the documentation on it isn't really that great. I am also glad I stopped trying to "reinvent the wheel" because this libraries seem like they will make my life a whole lot easier.
Well i think i am going to go with xajax. Right now i am working on some code for something similar to saxjax. As soon as i figure out how to add more info to the <div> placeholder all i have to do is add the database information. For those that are interested here is part of the code that allows one message to be posted minus the db.


Code:

<?php
   include '../xajax/xajax_core/xajax.inc.php';
   
   $xajax = new xajax();
   
   $xajax->registerFunction("writeTxt");
   
   function writeTxt($string) {
      $content = $string;
      
      $objResponse = new xajaxResponse();
      
      $objResponse->assign("messageTxt","innerHTML",$content);
      
      return $objResponse;
   }
   
   $xajax->processRequest();
   
   $xajax_js = $xajax->getJavascript('/xajax');
?>
<html>
<head>
<title>Message</title>
<?php echo $xajax_js; ?>
</head>
<body>
<form name="testform" id="testform" method="post">
<input type="text" name="message" id="message" />
<input type="button" onclick="xajax_writeTxt(xajax.$('message').value);" value="Send" />
</form>
<div id="messageTxt">Please enter a message</div>
</body>
</html>
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement