Passing in a form value via ajax. Ajax Submit Button

<div class="areaTxt"><textarea name="comments" cols="" rows="4" class="txtArea"></textarea>

  <div class="txtRht">


		echo CHtml::ajaxSubmitButton(


                                        array('eventdiscuss/addDiscussion?id='.$model->id.'&user_id='.Yii::app()->user->id.'&message='COMMENTS.VAL() I WANT HERE),

How would I go about passing the value of comments into that ajax submit button.

Better Yet:

better yet:



how can I fix this, message is not being set.

Thank You.

I would go this way:

Hey Bettor,

Thank you for taking the time to get back to me. Can you do me a favor and show me full code example of where to put it? Do declare a <script type="text/javascript"> and put it in it? or do I put it in the php side?

Also can you show me the code for the form?


I place the jquery code in a separate file and include it in the respective action where it’s called like:


The form can be any Yii generated form as far as the submit button has id and in the jquery code you capture this id value in the portion input[id="your id name here"];

Give it a try and let me know what works and what not and I will try to help you further.