Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Adding datas
26/02/2010
12:53
Avatar
JiheL
France
Member
Members
Forum Posts: 19
Member Since:
02/12/2009
sp_UserOfflineSmall Offline

Hello Tony,

First of all, thanks for your help about CSS trouble with modal dialog box, I hope you can solve it soon.

Now I'm going further and try to add some datas in my database with add modal box.

I saved my datas and that's fine.

My question is about how to validate datas before updating db :

[Image Can Not Be Found]

I would like to test if the 'code client' filled '44a' already exists in the db, in this case, adding datas cannot be performed and user have to be informed, otherwise I would like to populate 'raison sociale','site' in the row with extracted datas from db, and put 'code client' value in uppercase.

Here is my code for this field :

{name:'code',index:'code', width:30, sortable:true,
  editable:true,
  edittype:"text",
  editoptions:{
    readonly:false,size:5,maxlength:5
  },
  formoptions:{
    label:"Code client", elmprefix:"<font color='red'>&nbsp;*&nbsp;</font>"
  },
  editrules:{required:true,custom:true,custom_func:mycheck}
}

and the test function :

function mycheck(value,colname) {
  switch(colname){
    case "Code client":
      if(value > "") {
        $("#code").val()=value.toUpperCase();
        return [true,"OK",""];
      }
      break;
    default:
        return [false,"Code CLIENT erroné",""];
  }
}

I think that I have to put some code in this function for accessing db and extract fields values, but I don't know how to address row cols with these values.

And the last point, how to avoid to have added row when 'code clt' already exists in database ?

I have read many chapters in wiki without finding any way to progress. Sorry to disturb you in your great job.

I hope you will give me some way to continue.

Have a nice day and a good we.

Best regards

Jihel

01/03/2010
21:13
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

IMHO this is not jqGrid problem. We have a wide range of events to do what you want,  but we do not have a solutions on how you will check if the record exists in the database.

Instead maybe you will use ajax in mycheck function to determine if the record exists in the DB. The more important part here is that you need to use ajax with async option set to false.

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
35 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information