How to check unique records in edit/add mode ?

Talk about programming tricks and examples

Moderator: alexandrleonenko

mbreitkreuz1
Senior
Senior
Posts: 47
Joined: Jan 21st, '10, 15:47

How to check unique records in edit/add mode ?

Postby mbreitkreuz1 » Dec 20th, '10, 18:27

Hello,

I have a question:

After editing or adding a record I validate some values with the function ksm_onSubmitMyCheck(). ksm_ is my
unique prefix. Unfortunately I can't carry out database functions. I intend to check if a record is unique or not.
I wrote an own function and changed datagrid, but this message appears if I leave the edit or add mode.
The disadvantage is that the customer must add or edit the record once more and he would be a lttle angry.
Therefore it were better if I can remain in edit/add mode. Is there any possibility to do so, perhaps with ajax functionallity ?

Best regards,
mbreitkreuz

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to check unique records in edit/add mode ?

Postby administrator » Dec 21st, '10, 09:06

Yes, we've added such feature in the next version TODO list.
If you familiar with PHP and want to fix it manually, we can give the direction of how to do this.

mbreitkreuz1
Senior
Senior
Posts: 47
Joined: Jan 21st, '10, 15:47

Re: How to check unique records in edit/add mode ?

Postby mbreitkreuz1 » Dec 21st, '10, 09:50

Hello,

thank you very much.
Be so glad and tell me now what I must do to change it manually. Then I can test the functionality.

Thank you
and
best regards,
Manfred Breitkreuz

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to check unique records in edit/add mode ?

Postby administrator » Dec 23rd, '10, 13:16

The main idea is :

1. When you don't pass checking for uniqueness in AddRow() you have to return false value.
2. If AddRow() returns false, you have to set $req_mode = add;
3. In DrawColumnar() add all needed changes to make it working :)

If you cannot do it - simply wait to the next version.

mbreitkreuz1
Senior
Senior
Posts: 47
Joined: Jan 21st, '10, 15:47

Re: How to check unique records in edit/add mode ?

Postby mbreitkreuz1 » Dec 23rd, '10, 15:06

Hello,

yes I try it.
What do you think the new version will be announced ?

Best regards,
Manfred Breitkreuz

mbreitkreuz1
Senior
Senior
Posts: 47
Joined: Jan 21st, '10, 15:47

Re: How to check unique records in edit/add mode ?

Postby mbreitkreuz1 » Dec 23rd, '10, 15:11

Hello,
but the same changes you must do in UdateRow(), is that right ?

Best regrads,
Manfred Breitkreuz

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to check unique records in edit/add mode ?

Postby administrator » Dec 23rd, '10, 15:12

yes...

mbreitkreuz1
Senior
Senior
Posts: 47
Joined: Jan 21st, '10, 15:47

Re: How to check unique records in edit/add mode ?

Postby mbreitkreuz1 » Dec 23rd, '10, 15:40

Hello,

excuse me, only a short question:

The changes must also be done in the functions

DrawTabular(), DrawColumnar() and DrawCustomized() ?

Best regards,
Manfred Breitkreuz

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to check unique records in edit/add mode ?

Postby administrator » Dec 24th, '10, 06:40

Yes, but we recommend to start with DrawColumnar() only.
When everything will be ready, you may copy it to other functions

mbreitkreuz1
Senior
Senior
Posts: 47
Joined: Jan 21st, '10, 15:47

Re: How to check unique records in edit/add mode ?

Postby mbreitkreuz1 » Dec 24th, '10, 13:46

Hello thank you,

yes I'll try in new year but if it doesn't run I'll wait for your changes. You have a lot more experience than me.

Merry Christmas and a happy new Year,
Manfred Breitkreuz


Return to “Programming Tricks”