deskZombie
Posts: 8
|
| Posted: 06/16/2011, 1:22 PM |
|
Hi everyone... I'm a newbie to CCS, so please excuse my ignorance... 
... I added an Editable Grid (using the builder) to a blank page... nothing fancy...
its datasource is a table with the following structure...
(sorry that it isn't easy to read, but it didn't like my tabs)
Type Collation Null Default Extra
pmID int(10) No auto_increment
Name varchar(50) No
Email varchar(100) No
officeID int(2) No
where pmID is the primary key.
I didn't change/add anything in the code. And in the builder I check Autoincremented Primary Key.
So here's my problem....
whenever I submit the form, the Name and Email is set to blank in the table for all rows except the first row... and I can't for the life of me figure out why...
So here's whats in the grid before submit...
Pm ID Name Email Office ID
1 a a 1
2 b b 1
3 c c 2
4 d d 1
Here's whats in the grid after submit...
Pm ID Name Email Office ID
1 a a 1
2 1
3 2
4 1
All of the office ID stuff works fine. (If I change the values of the Office ID, it changes correctly in the table.)
I'm sure the problem has to do with the way I built the grid, but I'm not sure what other setting I should have changed.
Thanks in advance for taking the time to answer this. 
BTW... how do attach images to a post?
|
 |
 |
E43509
Posts: 283
|
| Posted: 06/17/2011, 5:30 AM |
|
What language are you using?
Do you have a default values set for all the fields?
You can also temporarily edit the update sql code to output to your screen after each row to see what it looks like.
|
 |
 |
deskZombie
Posts: 8
|
| Posted: 06/20/2011, 2:18 PM |
|
I'm using PHP... and mySQL with no default values set... the only setting on that table is the auto incrementing.
The update queries show that it's trying to update with blank fields... but I'm not sure why...
UPDATE t_table2 SET Name = 'a', Email = 'a', officeID = 1 WHERE pmID=1
UPDATE t_table2 SET Name = '', Email = '', officeID = 1 WHERE pmID=2
UPDATE t_table2 SET Name = '', Email = '', officeID = 2 WHERE pmID=3
UPDATE t_table2 SET Name = '', Email = '', officeID = 1 WHERE pmID=4
... again, the first row works fine, but not any others...
|
 |
 |
jjrjr2
Posts: 131
|
| Posted: 06/20/2011, 8:13 PM |
|
Be sure your table allows Null as a value in those fields
Change your update to
UPDATE t_table2 SET Name = NULL, Email = NULL, officeID = 1 WHERE pmID=2
Should work a little better
Hmmm. As I think about this I might be missing your issue...
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
Real Web Development At: http://RealWebDevelopment.us |
 |
 |
deskZombie
Posts: 8
|
| Posted: 06/21/2011, 8:51 AM |
|
jr - thanks for your comment...
but, i don't want the table to accept null... the name and email fields should be populated with the data on the grid... but it's not.
The form fields are POSTing as follows (if this helps anyone)...
Button_Submit Submit
FormState 4;1;pmID;1;2;3;4
officeID_1 1
officeID_2 1
officeID_3 2
officeID_4 1
Email_1 a
Email_2 b
Email_3 c
Email_4 d
Name_1 a
Name_2 b
Name_3 c
Name_4 d
... I'm still not understanding why the update queries are not building correctly...
|
 |
 |
jjrjr2
Posts: 131
|
| Posted: 06/21/2011, 10:34 AM |
|
Quote :I'm using PHP... and mySQL with no default values set... the only setting on that table is the auto incrementing.
The update queries show that it's trying to update with blank fields... but I'm not sure why...
UPDATE t_table2 SET Name = 'a', Email = 'a', officeID = 1 WHERE pmID=1
UPDATE t_table2 SET Name = '', Email = '', officeID = 1 WHERE pmID=2
UPDATE t_table2 SET Name = '', Email = '', officeID = 2 WHERE pmID=3
UPDATE t_table2 SET Name = '', Email = '', officeID = 1 WHERE pmID=4
... again, the first row works fine, but not any others...
LOL Now I am confused
The example you initially showed for the queries showed the updates trying to put null into the table...
That is why the first one worked and the rest failed is because the table is rejecting NULL for those fields...
I am guessing that is the issue.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
Real Web Development At: http://RealWebDevelopment.us |
 |
 |
deskZombie
Posts: 8
|
| Posted: 06/21/2011, 11:05 AM |
|
That's ok... I'm confused too... that's why I'm here... 
ok... let me try a visual...

... when I click submit, my queries look like this...
UPDATE t_table2 SET Name = 'a', Email = 'a', officeID = 1 WHERE pmID=1
UPDATE t_table2 SET Name = '', Email = '', officeID = 1 WHERE pmID=2
UPDATE t_table2 SET Name = '', Email = '', officeID = 2 WHERE pmID=3
UPDATE t_table2 SET Name = '', Email = '', officeID = 1 WHERE pmID=4
... they should like this...
UPDATE t_table2 SET Name = 'a', Email = 'a', officeID = 1 WHERE pmID=1
UPDATE t_table2 SET Name = 'b', Email = 'b', officeID = 1 WHERE pmID=2
UPDATE t_table2 SET Name = 'c', Email = 'c', officeID = 2 WHERE pmID=3
UPDATE t_table2 SET Name = 'd', Email = 'd', officeID = 1 WHERE pmID=4
|
 |
 |
jjrjr2
Posts: 131
|
| Posted: 06/21/2011, 11:14 AM |
|
LOL
Yup they should look like that...
You might have to build the editable grid again...
Did you add any custom code or event code???
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
Real Web Development At: http://RealWebDevelopment.us |
 |
 |
deskZombie
Posts: 8
|
| Posted: 06/21/2011, 11:18 AM |
|
I've tried to build the grid again...
and I have not yet added any custom code (except the debugging stuff, but it works the same with or without debugging code).
|
 |
 |
jjrjr2
Posts: 131
|
| Posted: 06/22/2011, 8:28 AM |
|
Hmmmm..
I rarely use editable grids. But I do think I would expect it's behaviour would be as you have noted.
Just for fun. What happens if you allow nulls in your table???
Does the original data get erased???
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
Real Web Development At: http://RealWebDevelopment.us |
 |
 |
deskZombie
Posts: 8
|
| Posted: 06/23/2011, 7:42 AM |
|
I changed the structure of the table to allow nulls...
and the grid still doesn't behave as expected...
the original data does get erased.
|
 |
 |
jjrjr2
Posts: 131
|
| Posted: 06/23/2011, 1:59 PM |
|
Hmmm...
Very strange...
Guess I will have to play with editable grids some...
As I said, I rarely use them but, when I have, I have never seen this problem.
Soo... a solution does not readily come to mind for me..
Sorry for now..
Maybe an editable grid expert (someone who uses editable grids 99.9999% of the time) will offer some insight here...
John

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
Real Web Development At: http://RealWebDevelopment.us |
 |
 |
deskZombie
Posts: 8
|
| Posted: 06/23/2011, 2:16 PM |
|
Thanks John!
|
 |
 |
guillen
Posts: 8
|
| Posted: 06/30/2011, 5:47 PM |
|
use custom update and see the staments in WHERE condition, see on field list if they are integer or char.
this happened to me when i use the wizard and no specified the cell type and correct them in design. If i use a custom update will have a cross cell char-integer and you get empty fields on database.
sorry my poor english.
|
 |
 |
|