Panos
asked on
cfgridcolumn validation
Hello experts.
I need help to validate editable cfgridcolumns.
I found a tutorial on this page:http://ajaxian.com/archives/coldfusion-8-grid-magic but i still have problems.
In this example the script is checking if it is a number.I also need to know how it works if i need to check for required fields,maxlength...
Any help?
I need help to validate editable cfgridcolumns.
I found a tutorial on this page:http://ajaxian.com/archives/coldfusion-8-grid-magic but i still have problems.
In this example the script is checking if it is a number.I also need to know how it works if i need to check for required fields,maxlength...
Any help?
My cfgrid:
<cfgrid name="Kategoriegrid" format="html" pagesize="30" insert = "Yes" sort="yes" width="100%"
rowheaderbold="yes" colHeaderBold = "Yes" pictureBar="yes" hspace="0" vspace="0" bind="cfc:cfc.kategories.getKategories({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{filtercolumn},{filter})" selectmode="edit" onchange= "cfc:cfc.kategories.updateKategories({cfGridAction},{cfgridrow},{cfgridchanged})">
<cfgridcolumn name="TABLE_ID" header="Table_id" select="no" display="false"/>
<cfgridcolumn name="KAT_ID" header="Kat ID" width="30" numberformat="9" <!--- select="no" ---> display="false"/>
<cfgridcolumn name="KAT_TEXT" header="Text" />
<cfgridcolumn name="mobiles_sub_id" header="Mobile" select="no"/>
<cfgridcolumn name="LangID" header="LangID" select="no"/>
</cfgrid>
<cfset AjaxOnLoad("init")>
my js:
<script language="JavaScript" type="text/javascript">
dataValidator = function(editEvent){
if (editEvent.field == "Kat_ID"){
if (isNaN(editEvent.value)){
alert("Please enter a numeric value in this field.");
editEvent.cancel = true;
}
}
}
addValidator = function(){
mygrid = ColdFusion.Grid.getGridObject('Kategoriegrid');
mygrid.on('validateedit',dataValidator);
}
init = function(){
addValidator();
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi pravinasar.
Can you help me with the clientside (javascript) validation.I usually use jquery validation for form fields,but how is this working with the gridcolumns:
Can you help me with the clientside (javascript) validation.I usually use jquery validation for form fields,but how is this working with the gridcolumns:
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you for your help
regards
panos
regards
panos
These you need to implement at clientside (Javascript) and at serverside too.