I am trying to setup a form with buttons only. The form should only submit via POST. While trying out some of the sweet CHtml options for this purpose I noticed some strange behaviours.
1.When setup my post submission via CHtml::linkButton(); all works well until I disabled javascript. Does linkButton uses jquery to push a POST submit?
2.When trying to use either CHtml::ajaxButton() or CHtml::ajaxSubmitButton() my form failed when javascript is disabled. Is there an option or parameter that can set these nice buttons to work as a regular submission if js is disabled?
It would be great if anyone helps me answer the above two questions.
Can’t say that i know for sure, but I presume not. They are clearly ajax helpers, which mean they are designed to use ajax. And that’s a JS thing in this case.
I have another question related to ajax submit and it is when I declare:
CHtml::ajaxSubmitButton() and according to the documentation I can include a 4th parameter array $htmlOptions=array ( ). In the html options I can declare ‘params’ but those parameters will be passed only when there is also ‘submit’=>‘url’ declared. If there is however a submit declared than the ajax is broken and Yii performs a regular POST submit. Is this the expected behavior as it does not make much sense to work that way. I would like to perform ajax request and still be able to pass params.
I am experiencing some other issues with ajax submit process. I am trying to develop a feedback form as a separate widget. I have a radiobutton list with ajax[yes, no]. So if the person clicks on yes ajax loads thank you for your feedback. If the person clicks on No ajax loads a text area and ajaxSubmitButton to submit the text area. The problem here is that clicking on the ajaxsubmitbutton submits the form as a regular post submission and never submits it via ajax. Why do you think is that.
OK I think was able to debug this little further by moving the ajax button to the portlet and got the following error:
Class_name does not have a method named "getModule".
Class_name is the class of my portlet. So I guess it expects the form to be handled by a controller class. Can anyone advise how to handle this in a portlet?