Welcome Guest, Not a member yet? Register   Sign In
CI & scriptaculous / ajax InPlaceEditor
#1

[eluser]sjmiller85[/eluser]
So, I have a portion of my app that I want the users to be able to submit comments. I have a portion that allows them to click on a portion of text, then using the InPlaceEditor I will have it turn into an input where the users can enter text and hit submit. Only problem... Whenever the user submits their comment, it returns and displays the parent controller instead of the comment (the default index of the currently displayed Controller). So now I have an entire hiccuped page in the small portion I am trying to display a small comment...

As of right now, I am having all scriptaculous calls go to a separate controller: "profileedits.php"
Code:
<?php

class Profileedits extends Controller {

    function __construct() {
        //Need to load the parent controller vice erroring out
        parent::Controller();

        $this->load->helper('url');
        $this->load->helper('date');
        $this->load->helper('form');
    }

    function addcomment($poiId) {
        $value = $this->db->escape($_POST['value']);
        return $value;
    }
}
?>

It's short and sweet right now, just wrote this up in a couple of minutes... and this is the portion of the controller and function that houses the InPlaceEditor. Note that it hiccups this controller's index page in place of where I want the comment displayed (and throws it all into a giant slurred mess of CSS 'disastery'): "personsofinterest.php"
Code:
<ul>
    <li class="category">Profile Comments</li>
    &lt;?php if ($selC->num_rows() > 0): ?&gt;
    &lt;?php foreach($selC->result() as $cRow): ?&gt;
    <li class="header">&lt;?=$cRow->title?&gt;</li>
    <li>&lt;?=$cRow->comment?&gt;</li>
    &lt;?php endforeach; endif; ?&gt;
    <li class="header" id="newTitle">New Comment</li>
    <li id="newComment">Add A New Comment</li>
</ul>
<js>
    new Ajax.InPlaceEditor('newComment', 'profileedits/addcomment/&lt;?=$id?&gt;');
</js>

EDIT: I have a feeling that there is something causing this beyond the script I could feasibly provide. Are there any settings or more "obvious" mistakes or practices that could result in it displaying the parent controller's index function?




Theme © iAndrew 2016 - Forum software by © MyBB