Define Allowable Values Example
Consider the following table:
CREATE TABLE tblDemo( pkID INT PRIMARY KEY AUTO_INCREMENT, fldField1 VARCHAR(40), fldField2 VARCHAR(40), fldField3 VARCHAR(40), fldCertainFields VARCHAR(40), fldLongField TEXT );
fldField1 | fldField2 | fldCertainFields | fldLongField | Action |
---|---|---|---|---|
buyjhgb | nkjnk | This is another Value | n n | |
ss | ddd | This is another Value | asa | |
dfsdfsdfsdf | 444444444444 | NEW Value | sdfsdfsdfsdfsdfsdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
Class Implementation:
#required file and class
require_once ('preheader.php');
include_once ('ajaxCRUD.class.php')
#this one line of code is how you implement the class
$tblDemo = new ajaxCRUD("New Item", "tblDemo", "pkID");
$tblDemo->omitPrimaryKey();
$allowable_vals = array("My Awesome Value",
"This is another Value",
"NEW Value", "OLD Value");
$tblDemo->defineAllowableValues("fldCertainValues",
$allowable_vals);
#actually show to the table
$tblDemo->showTable();
View Example by Itself
Click here to view example outside of the template.
Recent Feedback
(did you have this years ago...? haha)" - Posted by Jake on Wednesday Jul 16th, 2008 at 10:08pm
after submiting form i get like something :
%u0442%u0435%u0441%u0442 %u0435%u0441%u0442
Help! =)
" - Posted by Yuri on Sunday Jul 27th, 2008 at 9:54am
Great api. Really love the demo.
I`ve just spent the better part of the morning installing it for use in my application. So far, so good.
There is a problem with the input saving to my database however. It calls up my database table fields fine, I enter the information but it doesn`t save to my database and the webpage shows a broken/empty icon where my information should be displayed.
Can you help me with this issue, please." - Posted by Ade on Tuesday Nov 11th, 2008 at 8:42am
Anywho, GREEEAT functions! Easily understandable code, I`m loooovving it :D
I did fell over a tiny bug on this page. If you click to edit a text field, and do not change anything and press enter, it comes with an error "Error updating content". It should be clever enough to see, that nothing`s changed and then go on with it anywho - updating or not updating, but there`s no error :)
Great work!" - Posted by Svend Koustrup on Saturday Mar 7th, 2009 at 7:04am
this is awesome men, just one more thought, how about relationship between 3 or more tables?
thanks" - Posted by jing tuibeo on Sunday Oct 11th, 2009 at 2:24am
i am having problem in putting date in dd/mm/yyyy format as mysql accept it in yyyy-dd-mm so all my date field shows as 0000-00-00.
Please give me the link if the problem is already solved.
i tried following code but did not worked
$tblDemo->onAddExecuteCallBackFunction("newdate1");
function newdate1($array){
$caseID = $array[id];
//
$caseDate = $array[caseDate];
$aDate = explode(`/`,$caseDate);
$newDate = $aDate[2].`-`.$aDate[1].`-`.$aDate[0] ;
//
$caseDateName = $array[caseDate];
$success = qr("UPDATE cases SET caseDate = $newDate WHERE id = $caseID");
echo $success;
} " - Posted by gunjan kumar on Thursday Feb 11th, 2010 at 1:59am
Saved insane amounts of time.
`nuff said." - Posted by Soule on Sunday Mar 28th, 2010 at 8:58am