Sunday, April 4, 2010

How to validate entry in cfgrid

cfform formate = flash

cfgrid selectmode = edit



I have a column in my cfgrid that users can select on and
input a date (pick a date would be even better, but that is for
another time) - I want to validate that they actually put in a
valid date, but how?



I have a mask that will put the entry in the correct format,
but if the user puts in something that is not a date, it simply
changes the field to be blank.How to validate entry in cfgrid
not sure what version you are using but CF8 has %26lt;input
type=''datefield''%26gt; that would handle all of that for you... is
that a possibility for you?How to validate entry in cfgrid
If I were using a standard cfform with inputs then I would
understand, but I'm not, I'm using a cfgrid that can be edited. So
where would your suggestion go?



%26lt;cfquery name=''getComponents'' datasource=''mileage''%26gt;

SELECT partID, bikeID, itemName, brand, model, size,
material, piDate, extra

FROM bikeParts

WHERE bikeID = 1

%26lt;/cfquery%26gt;



%26lt;!--- FORM ---%26gt;

%26lt;cfform format=''flash''

action=''formdump.cfm''

style=''themeColor:##ff0000; background-color:##006600;''

width=''100%''

height=''100%''%26gt;



%26lt;cfformgroup type=''panel'' label=''? Bike Components''%26gt;



%26lt;cfformitem type=''html''%26gt;

To edit items within the grid, simply click on the item(s)
you wish to change, and make your changes.

%26lt;br /%26gt;When you are done, click the submit button.

%26lt;/cfformitem%26gt;



%26lt;!--- The hbox aligns the grid and the button vbox
horizontally ---%26gt;

%26lt;cfformgroup type=''hbox''

style=''vertical-align:bottom; horizontalAlign:center;''%26gt;



%26lt;!--- In order for things to align properly, all of the
hbox children must be in containers, so the cfgrid tag must be in a
vbox ---%26gt;

%26lt;cfformgroup type=''vbox''%26gt;

%26lt;cfgrid name=''componentChart''

query=''getComponents''

selectmode=''edit''

rowheaders=''no''

colheaders=''yes'' colheaderbold=''yes''

height=''400'' width=''1000'' %26gt;

%26lt;cfgridcolumn width=''100'' name=''itemName'' display=''yes''
header=''Component'' select=''no'' /%26gt;

%26lt;cfgridcolumn width=''100'' name=''brand'' display=''yes''
header=''Brand'' /%26gt;

%26lt;cfgridcolumn width=''100'' name=''model'' display=''yes''
header=''Model'' /%26gt;

%26lt;cfgridcolumn width=''75'' name=''size'' display=''yes''
header=''Size'' /%26gt;

%26lt;cfgridcolumn width=''125'' name=''material'' display=''yes''
header=''Material'' /%26gt;

%26lt;cfgridcolumn width=''100'' name=''piDate'' display=''yes''
header=''Began Using'' mask=''mmm d, yyyy'' dataalign=''center'' /%26gt;

%26lt;cfgridcolumn width=''400'' name=''extra'' display=''yes''
header=''Notes'' /%26gt;

%26lt;/cfgrid%26gt;



%26lt;cfinput type=''submit''

name=''btnSubmit''

value=''Submit''

width=''125'' /%26gt;

%26lt;/cfformgroup%26gt;



%26lt;/cfformgroup%26gt;



%26lt;/cfformgroup%26gt;



%26lt;/cfform%26gt;

No comments:

Post a Comment