Re: populate form contents ajax
Which version are you using ? Strange syntax for the url in your $ajax- submit (should be /Controller/method) . On Jun 18, 8:22 pm, varunkrish [EMAIL PROTECTED] wrote: Thanks for the quick reply I have a text box which contains the post id and a edit form in the div id=edit below ?php echo $ajax-form(array('action'=$html-url('ajaxedit/')))? ?php echo $html-input('Post/id') ? ?php echo $ajax-submit('Load Phone', array('url' = 'ajaxedit/','update'='ajaxpost'))? div id=ajaxpost ?php echo $html-input('Post/name', array('size' = '20'))? /div In Controller i Have the ajaxedit method function ajaxedit($id=null){ if(!empty($this-data)){ $this-Post-id = $id; $this-data = $this-Post-read(); print_r($Post); $this-layout = ajax; } } But i get only the id in the view after ajax update. Name is empty ? why ? thanks, Varun On Jun 17, 3:39 am, francky06l [EMAIL PROTECTED] wrote: One more thing, with ajax you very often need to set the parameter update of link, submit, remote_function etc ... This update whould match the div you will update into the view. Your rendering view would be enclosed into $ajax-div('updatedivname') / $ajax- divEnd(...) On Jun 17, 12:35 am, francky06l [EMAIL PROTECTED] wrote: for the controller aspect it does not change anything posting data using ajax or not. The data posted are accessible in the same way ($this-params['data']['Controller'] .. for example). The same approach for the rendering. Now everything resides into which parts of the view you update with you ajax call (basically doing ajax will not affect your controller code). The difference wiht ajax resides into the view (thtml ot tcp). On Jun 16, 8:47 pm, varunkrish [EMAIL PROTECTED] wrote: ?php echo $ajax-form(array('action'=$html-url('edit')))? div id=editAll style=display:noneLoading..?php echo $html-image('spinner.gif',array('alt'='Saving..','id'='editAllimg'))? /div ?php print $ajax-submit('Load Post', array('url' = 'editAll/','update'='posts','frequency'='2','loading'=Element.show('editAll');,'loaded'=Element.hide('editAll');));? I have a view for add post , but i have text input for edit post . if i type a post id in the edit post and give read.. the form contents should be populated via ajax ? my doubt is i know how to save data (add or edit) via ajax by sending data to the controller but how to get back data from the controller and populate form contents ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: populate form contents ajax
for the controller aspect it does not change anything posting data using ajax or not. The data posted are accessible in the same way ($this-params['data']['Controller'] .. for example). The same approach for the rendering. Now everything resides into which parts of the view you update with you ajax call (basically doing ajax will not affect your controller code). The difference wiht ajax resides into the view (thtml ot tcp). On Jun 16, 8:47 pm, varunkrish [EMAIL PROTECTED] wrote: ?php echo $ajax-form(array('action'=$html-url('edit')))? div id=editAll style=display:noneLoading..?php echo $html-image('spinner.gif',array('alt'='Saving..','id'='editAllimg'))? /div ?php print $ajax-submit('Load Post', array('url' = 'editAll/','update'='posts','frequency'='2','loading'=Element.show('editAll');,'loaded'=Element.hide('editAll');));? I have a view for add post , but i have text input for edit post . if i type a post id in the edit post and give read.. the form contents should be populated via ajax ? my doubt is i know how to save data (add or edit) via ajax by sending data to the controller but how to get back data from the controller and populate form contents ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: populate form contents ajax
One more thing, with ajax you very often need to set the parameter update of link, submit, remote_function etc ... This update whould match the div you will update into the view. Your rendering view would be enclosed into $ajax-div('updatedivname') / $ajax- divEnd(...) On Jun 17, 12:35 am, francky06l [EMAIL PROTECTED] wrote: for the controller aspect it does not change anything posting data using ajax or not. The data posted are accessible in the same way ($this-params['data']['Controller'] .. for example). The same approach for the rendering. Now everything resides into which parts of the view you update with you ajax call (basically doing ajax will not affect your controller code). The difference wiht ajax resides into the view (thtml ot tcp). On Jun 16, 8:47 pm, varunkrish [EMAIL PROTECTED] wrote: ?php echo $ajax-form(array('action'=$html-url('edit')))? div id=editAll style=display:noneLoading..?php echo $html-image('spinner.gif',array('alt'='Saving..','id'='editAllimg'))? /div ?php print $ajax-submit('Load Post', array('url' = 'editAll/','update'='posts','frequency'='2','loading'=Element.show('editAll');,'loaded'=Element.hide('editAll');));? I have a view for add post , but i have text input for edit post . if i type a post id in the edit post and give read.. the form contents should be populated via ajax ? my doubt is i know how to save data (add or edit) via ajax by sending data to the controller but how to get back data from the controller and populate form contents ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---