⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Successful insertion results in text area instead of success message...



Dale

Dale
  • profile picture
  • Member

Posted 04 April 2013 - 13:40 PM

When I've inserted a value into a table (works - the table is updated) GC displays a page with the following source...

 

 

<textarea>{"success":true,"insert_primary_key":true,"success_message":"<p>Your data has been successfully updated. <a href='http:\/\/localhost:8888\/employee\/table'>Go back to list<\/a><\/p>","success_list_url":"http:\/\/localhost:8888\/employee\/table\/success\/1"}</textarea>

 

Not sure why it has ended up in a text area.

 

Also the insert page is laid out vertically (i presume it flows to this if there isn't enough room), and date fields no longer pop up with a date picker (you have to enter the date manually).

 

Any ideas?

 

Thanks,

 


Zalo

Zalo
  • profile picture
  • Member

Posted 04 April 2013 - 16:57 PM

I think you may have some js breaking something or something configured wrong in the server/.htaccess/somewhere .

That textarea is the standard return of any add/edit operation, but it is normally processed by a js that make everything works.

 

About the layout, it depends mostly on the theme you are using.

 

The date field also points to some js error in the form.

 

Check the "inspect element" option (assuming you are using Chrome) to see the errors you are getting. Without that information I really can't help you much more than this.

 

Hope it helped!


Dale

Dale
  • profile picture
  • Member

Posted 04 April 2013 - 20:07 PM

These are the js files that are included...

 

 

                <link type="text/css" rel="stylesheet" href="http://localhost:8888/assets/grocery_crud/css/jquery_plugins/chosen/chosen.css" />

                <link type="text/css" rel="stylesheet" href="http://localhost:8888/assets/grocery_crud/themes/flexigrid/css/flexigrid.css" />

 

                <script src="http://localhost:8888/assets/grocery_crud/js/jquery-1.8.1.min.js"></script>

                <script src="http://localhost:8888/assets/grocery_crud/js/jquery_plugins/jquery.chosen.min.js"></script>

                <script src="http://localhost:8888/assets/grocery_crud/js/jquery_plugins/config/jquery.chosen.config.js"></script>

                <script src="http://localhost:8888/assets/grocery_crud/themes/flexigrid/js/jquery.form.js"></script>

                <script src="http://localhost:8888/assets/grocery_crud/themes/flexigrid/js/flexigrid-add.js"></script>

 

 

Ah, just found that when the main page is loaded (before I insert anything) I get...

 

 

TypeError: 'undefined' is not a function (evaluating '$('#crud_page').numeric()') from flexigrid.js (line 196)

 

 

-------------

update - found the issue - there was a 2nd include of a jquery <sigh>


Zalo

Zalo
  • profile picture
  • Member

Posted 05 April 2013 - 05:54 AM

Yup, reincluding jQuery (GC loads it by default) "unsets" all the plugins that where set after the first load.

Glad you found the error!


Marcos Sánchez Urquiola

Marcos Sánchez Urquiola
  • profile picture
  • Member

Posted 21 February 2014 - 18:43 PM

This problem definately has to do with Jquery.

  • It could be the Jquery version you are using. Always use a couple of versions behind not the latest one for it may have some issues adjusting. 
  • If you're using your very own datepicker library for example, it may collide with the crud's own datepicker library and you end up with this error. (this is what happened to me) so I went ahead and commented out the $js_files variable which loads all the jquery plugins in the Grocery Crud library and wrote them down (call them) by hand leaving out the datepicker plugins.
  • On the form page, run Firebug, reload and see if there's any javascript error there, if there is, it will prevent the success message from showing up correctly showing instead the dreaded textarea error.

That's it, easy squeezy.