DataGrid records cannot be updated and saved

A place for users and developers of the Xataface to discuss and receive support.

DataGrid records cannot be updated and saved

Postby wyhauyeung » Wed Dec 02, 2009 2:39 am

Hello. Greetings from user in Japan.

Xataface is really a great web application framework.

I have a problem want to ask.

I installed DataGrid (ver 0.2) in my Xataface applications, when I used admin role to login, the grid can be viewed properly without problems.
But when I tried to update records, although the records can be seen modified on the real-time grid screen, after 5 secs the red mark is still there and it turns out that the record cannot be updated..

Anyone knows whats the problems?

Thanks a lot.
Will
wyhauyeung
 
Posts: 3
Joined: Wed Dec 02, 2009 2:26 am

Postby ststoddard » Thu Dec 10, 2009 11:53 am

I have the exact same issue. Can't add rows nor update -- that is, the changes are not committed to the database. The red flag never goes away.

I did the standard install and have the Admin role.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Fri Dec 11, 2009 10:28 am

Are there any javascript errors being reported?
If you check your server log, are any PHP errors reported?

The save functionality occurs in the js/DataGrid.js file.

Search for "Ext.Ajax.request" to find the part where the save occurs.
You can do a little debugging by adding an alert after the line:

Code: Select all
success: function(response,options){

so that it says
Code: Select all
success: function(response,options){
    alert(response);
}


This will show you exactly what the server is sending back on a save.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ststoddard » Fri Dec 11, 2009 10:45 am

Thanks for the tips…

I am, however, unable to get anything out of them. Don't know enough about all of this, I think.

I checked the apache and mysql logs, nothing to indicate a php error. Somewhere else I should look? I am hosting this from Ubuntu Linux 7.04.

I also edited DataGrid.js as you recommended, reloaded the page, and tried again. Same issue (of course) but nothing happens… where would I look for the message?

Sorry for the ineffectiveness here…

Steve
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby ststoddard » Fri Dec 11, 2009 10:46 am

Just a quick addition, not sure it relates, but I have never been able to get any of the AJAX options to work properly.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Fri Dec 11, 2009 10:50 am

I've blocked some time off on my schedule later this morning to look into this issue... hopefully I can have it resolved.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Dec 11, 2009 12:06 pm

OK.. I have fixed the issue with not saving updates (not sure if this addresses the problem for adding new rows). You can download the fix from SVN:
http://weblite.ca/svn/dataface/modules/ ... ataGrid.js


Just replace your js/DataGrid.js file with this one.


In regards to your comment that no AJAX functions have ever worked for you, this could be caused if you are hosting Dataface at a slightly different domain than your application. E.g. in your index.php file, the 2nd parameter of df_init(), if you have a full URL for your dataface url, and the domain doesn't match your app domain, then AJAX will not work.

Better to use a relative path to xataface.
e.g.
use
df_init(__FILE__, '/path/to/xataface')
instead of
df_init(__FILE__,'http://www.mydomain.com/path/to/xataface');

In the second case, it wouldn't work if you accessed the app under http://mydomain.com, only http://www.mydomain.com.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ststoddard » Fri Dec 11, 2009 12:20 pm

mmm… Thanks, but no luck. I downloaded the new file and replaced the old one and still have the same problem.

Also, regarding AJAX, I use a relative path. And I should have qualified my statement: it works, sort of, but is very slow and finicky. Takes sometimes, not others.

Not helping much, am I?
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Fri Dec 11, 2009 12:26 pm

You may need to hit refresh, or clear your temp internet files in order for your browser to pick up the new version.

Which browser, OS, Xataface version, PHP version are you using?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ststoddard » Fri Dec 11, 2009 12:51 pm

I use Safari, usually, but just tried with Firefox and have the same problem still.

If it helps, when I look at the error console in Firefox I get the following errors:
Unknown property 'zoom'. Declaration dropped.
Unknown property '-moz-opacity'. Declaration dropped.
Error in parsing value for 'filter'. Declaration dropped.
The 'charCode' property of a keydown event should not be used. The value is meaningless.
The 'charCode' property of a keyup event should not be used. The value is meaningless.


Lots of them.

I am using PHP 5.2.1, Apache 2.2.3.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby ststoddard » Fri Dec 11, 2009 12:52 pm

And am using Xataface 1.2.2.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Fri Dec 11, 2009 1:02 pm

Any chance you can make your app accessible to me so I can try it out and see if I notice anything?

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Dec 11, 2009 3:24 pm

I believe I have found the problem. If you have magic_quotes_gpc enabled on your webserver, Xataface was not properly stripping the slashes that are added to the POST arrays.

If you replace your current config.inc.php file with the one at
http://weblite.ca/svn/dataface/core/tru ... ig.inc.php
it will fix the issue.

This would make sense for why many ajax things were not working correctly for you, as many ajax requests involve posting JSON data which gets garbled when magicquotes adds slashes to quotes.

It is recommended to have magic quotes disabled on your server as it causes nothing but problems ---- however if you have other scripts that have been developed and depend on it, then you may want to be careful in making such a change.

Best regards

Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ststoddard » Fri Dec 11, 2009 3:55 pm

That did the trick. I had no reason to have magic quotes on and wasn't even aware of that option. They were set to on by default, apparently.

Thanks!
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Mon Dec 14, 2009 10:39 am

The fix that I supplied actually causes a problem if magic_quotes_gpc is enabled, as in some cases it causes slashes to be stripped twice. This would probably only be noticeable when uploading files to a blob field.

To properly fix this issue, you need to update the following files to the latest:

http://weblite.ca/svn/dataface/core/tru ... ig.inc.php
http://weblite.ca/svn/dataface/core/tru ... ckForm.php

Description of this change:
HTML_Quickform now detects if slashes have already been stripped before attempting to strip them.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Next

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 37 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved