Help with this Jtree extensions please.

Trying to implement this extension, and I’m just too noob to get this working correctly, although it sounds like it should be easy. The author of the extension states what needs to be done in this paragraph:

<?php //add in the options array of the input field that represents your model’s name,

//so that the name field is fille"value"=> $namevalued automatically with the name you type in the jstree when you create a new node.(like in demo).

//If you are just updating a model,the stored value will fill in the name field as usual.

//You have to do this manually because of the limited ability to interfere with the code generation,without

//doing some extending or overriding which I feel is not worth the effort,for such a minor thing.

$namevalue=(!$model->isNewRecord) ?$model->name:$newname ;

Everything is working correctly aside from this one part.

<!–/**

*/–>

<div id="form_wrapper" class="client-val-form">

<?php if ($_POST[‘create_root’]==‘true’ && $model->isNewRecord) : ?> <h3 id=“create_header”><span style=“color:#4079C8”>Create New Root Student</span></h3>

&lt;?php elseif (&#036;model-&gt;isNewRecord) : ?&gt;    &lt;h3 id=&quot;create_header&quot;&gt;&lt;span style=&quot;color:#4079C8&quot;&gt;Create New Student&lt;/span&gt;&lt;/h3&gt;





&lt;?php    elseif (&#33;&#036;model-&gt;isNewRecord): ?&gt;    &lt;h3 id=&quot;update_header&quot;&gt;Update Student &lt;span  style=&quot;color:#4079C8&quot;&gt;&lt;/span&gt;&lt;/h3&gt;


    


&lt;?php   endif; ?&gt;





&lt;?php 


&#036;val_error_msg = 'Error.Student was not saved.';


&#036;val_success_message = (&#036;model-&gt;isNewRecord) ?


'Student was created successfuly.' :


'Student was updated successfuly.';


?&gt;





&lt;div id=&quot;success-note&quot; class=&quot;notification success png_bg&quot; style=&quot;display:none;&quot;&gt;


    &lt;a href=&quot;#&quot; class=&quot;close&quot;&gt;


         &lt;img


            src=&quot;&lt;?php echo Yii::app()-&gt;request-&gt;baseUrl;?&gt;/js_plugins/ajaxform/images/icons/cross_grey_small.png&quot;


            title=&quot;Close this notification&quot; alt=&quot;close&quot;/&gt;


     &lt;/a&gt;


    &lt;div&gt;


        &lt;?php echo &#036;val_success_message;?&gt;


    &lt;/div&gt;


&lt;/div&gt;





&lt;div id=&quot;error-note&quot; class=&quot;notification errorshow png_bg&quot; style=&quot;display:none;&quot;&gt;


    &lt;a href=&quot;#&quot; class=&quot;close&quot;&gt;


        &lt;img


            src=&quot;&lt;?php echo Yii::app()-&gt;request-&gt;baseUrl;?&gt;/js_plugins/ajaxform/images/icons/cross_grey_small.png&quot;


            title=&quot;Close this notification&quot; alt=&quot;close&quot;/&gt;


    &lt;/a&gt;


    &lt;div&gt;


        &lt;?php echo &#036;val_error_msg;?&gt;            


    &lt;/div&gt;

</div>

&lt;div id=&quot;ajax-form&quot; class=&quot;form&quot;&gt;





    &lt;?php          


    &#036;formId = 'student-form';


    &#036;actionUrl = (&#036;model-&gt;isNewRecord) ?


    ( (&#036;_POST['create_root']&#33;='true')?CController::createUrl('student/create'):


    CController::createUrl('student/createRoot')):


    CController::createUrl('student/update');





    &#036;form = &#036;this-&gt;beginWidget('CActiveForm', array(


    'id' =&gt; &#036;formId,


    'htmlOptions' =&gt; array('enctype' =&gt; 'multipart/form-data'),


    'action' =&gt; &#036;actionUrl,


    // 'enableAjaxValidation'=&gt;true,


    'enableClientValidation' =&gt; true,


    'focus' =&gt; array(&#036;model, 'name'),


    'errorMessageCssClass' =&gt; 'input-notification-error error-simple png_bg',


    'clientOptions' =&gt; array('validateOnSubmit' =&gt; true,


    'validateOnType' =&gt; false,


    'afterValidate' =&gt; 'js:function(form,data,hasError){ &#036;.js_afterValidate(form,data,hasError); }',


    'errorCssClass' =&gt; 'err',


    'successCssClass' =&gt; 'suc',


    'afterValidateAttribute' =&gt; 'js:function(form, attribute, data, hasError){


    &#036;.js_afterValidateAttribute(form, attribute, data, hasError);


    }'


    ),


    ));


    ?&gt;


[color=&quot;#FF00FF&quot;]   &lt;?php          //add  in the options array of the input field that represents your model's name,


    //so that the name field  is fille&quot;value&quot;=&gt; &#036;namevalued automatically with the name you type in the jstree when you create a new node.(like in demo).


    //If you are just updating a model,the stored value will fill in the name field as usual.


    //You have to do this manually because of the limited ability to interfere with the code generation,without


    //doing some extending or overriding which I feel is not worth the effort,for such a minor thing.





    &#036;namevalue=(&#33;&#036;model-&gt;isNewRecord) ?&#036;model-&gt;name:&#036;newname ;


    


    ?&gt;[/color]


    &lt;?php  echo &#036;form-&gt;errorSummary(&#036;model,


    '&lt;div style=&quot;font-weight:bold&quot;&gt;Please correct these errors:&lt;/div&gt;


    ', NULL, array('class' =&gt; 'errorsum notification errorshow png_bg'));


    ?&gt;        


    &lt;p class=&quot;note&quot;&gt;Fields with &lt;span class=&quot;required&quot;&gt;*&lt;/span&gt; are required.&lt;/p&gt;





    &lt;div class=&quot;row&quot;&gt;


        &lt;?php echo &#036;form-&gt;labelEx(&#036;model,'name'); ?&gt;


        &lt;?php echo &#036;form-&gt;textField(&#036;model, 'name', array('maxlength' =&gt; 50)); ?&gt;


        &lt;span id=&quot;success-Student_name&quot;


              class=&quot;hid input-notification-success  success png_bg right&quot;&gt;&lt;/span&gt;


        &lt;div&gt;


            &lt;small&gt;&lt;/small&gt;


        &lt;/div&gt;


        &lt;?php echo &#036;form-&gt;error(&#036;model,'name'); ?&gt;


    &lt;/div&gt;


            &lt;div class=&quot;row&quot;&gt;


        &lt;?php echo &#036;form-&gt;labelEx(&#036;model,'description'); ?&gt;


        &lt;?php echo &#036;form-&gt;textField(&#036;model, 'description', array('maxlength' =&gt; 200)); ?&gt;


        &lt;span id=&quot;success-Student_description&quot;


              class=&quot;hid input-notification-success  success png_bg right&quot;&gt;&lt;/span&gt;


        &lt;div&gt;


            &lt;small&gt;&lt;/small&gt;


        &lt;/div&gt;


        &lt;?php echo &#036;form-&gt;error(&#036;model,'description'); ?&gt;


    &lt;/div&gt;


    





    &lt;div class=&quot;row&quot;&gt;


        &lt;?php  echo &#036;form-&gt;fileField(&#036;model,'student_image'); ?&gt;            


        &lt;div&gt;


            &lt;small&gt;&lt;?php echo 'Student Image';?&gt;&lt;/small&gt;


        &lt;/div&gt;


    &lt;/div&gt;








    &lt;div class=&quot;row&quot;&gt;


        &lt;select data-placeholder=&quot;Choose Classrooms...&quot;


                name=&quot;Student[classrooms][]&quot;


                class=&quot;classroom-select&quot; multiple=&quot;true&quot;


                style=&quot;width: 250px;&quot; tabindex=&quot;-1&quot;&gt;


            &lt;option value=&quot;&quot;&gt;&lt;/option&gt;


            &lt;?php  &#036;this-&gt;related_opts(&#036;model);?&gt;                


        &lt;/select&gt;


        &lt;div&gt;


            &lt;small&gt;&lt;?php echo 'Classrooms in this Student';?&gt;&lt;/small&gt;


        &lt;/div&gt;


    &lt;/div&gt;

<div class="row">

    &lt;input type=&quot;hidden&quot; name=&quot;YII_CSRF_TOKEN&quot;   value=&quot;&lt;?php echo Yii::app()-&gt;request-&gt;csrfToken;?&gt;&quot;/&gt;

</div>

<div class="row">

    &lt;input type=&quot;hidden&quot; name=&quot;parent_id&quot; value=&quot;&lt;?php  echo &#036;_POST['parent_id'];?&gt;&quot;/&gt;

</div>

    &lt;?php  if (&#33;&#036;model-&gt;isNewRecord): ?&gt;        


    &lt;div class=&quot;row&quot;&gt;


    &lt;input type=&quot;hidden&quot; name=&quot;update_id&quot;    value=&quot;&lt;?php  echo &#036;_POST['update_id']; ?&gt;&quot;/&gt;


     &lt;/div&gt;


    &lt;?php endif; ?&gt;








        &lt;?php  if (&#33;&#036;model-&gt;isNewRecord): ?&gt;


        &lt;div class=&quot;row&quot;&gt;


            &lt;?php echo &#036;form-&gt;hiddenField(&#036;model, 'student_id', array('value' =&gt; &#036;model-&gt;id));?&gt;                


        &lt;/div&gt;


        &lt;?php endif; ?&gt;





    


        &lt;div class=&quot;row buttons&quot;&gt;


            &lt;?php                 


            echo CHtml::submitButton(&#036;model-&gt;isNewRecord ? 'Submit' : 'Save', array('class' =&gt; 'button align-right'));


            ?&gt;                


        &lt;/div&gt;


        &lt;?php  &#036;this-&gt;endWidget();?&gt;            


    &lt;/div&gt;


    &#60;&#33;-- form --&#62;





&lt;/div&gt;

<!–</div> -->

<script type="text/javascript">

&#036;(function () {


    //multiple selection list


    &#036;(&quot;.classroom-select&quot;).chosen();





    //Close button on top of ajax response div


    &#036;(&quot;.close&quot;).click(


            function () {


                &#036;(this).parent().fadeTo(400, 0, function () { // Links with the class &quot;close&quot; will close parent


                    &#036;(this).slideUp(600);


                });


                return false;


            }


    );


});

</script>

Anyone mind taking taking a stab at this, the part I need help with is highlighted in pink. Really appreciate your time.

This is in such an encouraging post, it is really great piece of data.<br />

I have confuse on here &lt;div class=&quot;row&quot;&gt;<br />

&lt;input type=&quot;hidden&quot; name=&quot;parent_id&quot; value=&quot;&lt;?php echo $_POST[‘parent_id’];?&gt;&quot;/&gt;<br />

&lt;/div&gt;<br />

<br />

<br />

&lt;?php if (!$model-&gt;isNewRecord): ?&gt; <br />

&lt;div class=&quot;row&quot;&gt;<br />

&lt;input type=&quot;hidden&quot; name=&quot;update_id&quot; value=&quot;&lt;?php echo $_POST[‘update_id’]; ?&gt;&quot;/&gt;<br />

&lt;/div&gt;<br />

&lt;?php endif; ?&gt;<br />

<br />

<br />

&lt;?php if (!$model-&gt;isNewRecord): ?&gt;<br />

&lt;div class=&quot;row&quot;&gt;<br />

&lt;?php echo $form-&gt;hiddenField($model, ‘student_id’, array(‘value’ =&gt; $model-&gt;id));?&gt; <br />

&lt;/div&gt;<br />

&lt;?php endif; ?&gt;<br />

<br />

<br />

&lt;div class=&quot;row buttons&quot;&gt;<br />

&lt;?php <br />

echo CHtml::submitButton($model-&gt;isNewRecord ? ‘Submit’ : ‘Save’, array(‘class’ =&gt; ‘button align-right’));<br />

?&gt; <br />

&lt;/div&gt;<br />

&lt;?php $this-&gt;endWidget();?&gt; <br />

&lt;/div&gt;<br />

<!-- form --><br />

plz advise.<br />