|
Rank: Newbie Groups: Member
Joined: 10/26/2012 Posts: 3
|
Hi Guys,
I need some help in EO Web Grid validation. I want to perform validation on each every grid cell with its color change. I want to validate username, password, phone, email, web etc on Grid cells. If any of the validation gets failed, cell color should get changed with red color. I am able to load the data into Grid in fullrowmode false and able to edit the data but I am not able to perform validations on cells. Your help needed in this regard. Early reply would be helpfull and appreciated.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, You would handle the GridCell's ClientSideOnEndEdit: http://www.essentialobjects.com/doc/1/jsdoc.public.handlers.grid_column_endedit.aspxThe code would be something like this:
Code: HTML/ASPX
<eo:Grid ...>
<Columns>
.....
<eo:TextBoxColumn ClientSideOnEndEdit="your_end_edit_handler" .... />
......
</Columns>
.....
</eo:Grid>
The end edit handler is called before user leaves edit mode for a cell. The second argument passed to your handler is the new value user entered, you can check that value against whatever else and then return the "right" value from your handler. The Grid will then accept the value you return from your handler. Inside the handler you can also check values for other cells with the Grid's client side API. If you are not familiar with our client side API, you will want to go over this topic: http://www.essentialobjects.com/doc/1/clientapi_howto.aspxHope this helps. Please feel free to let us know if you have any more questions. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/26/2012 Posts: 3
|
Hi,
Thanks for the reply. Yes, I did the same what you people suggested in your site. Here is my textbox and handler function code.
<eo:TextBoxColumn DataField="Password" HeaderText="Password" Name="password" ClientSideEndEdit="validatePassword" TextBoxMaxLength="15">
function validatePassword(cell, input) {
var re = "/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])\w{6,}$/";
var validPassword = re.test(input);
if (validatePassword) { return input; } else { return cell.getValue(); } }
When I execute the application, I am getting js script error at "re.test(input);" this position saying that "Microsoft JScript runtime error: Object doesn't support property or method 'test'" etc. I have huge number of columns which has to be validated. A good example would be much helpful for me. Apart from this, I want to display cell color in red if validation gets failed. How can I do that. If you provide me simple example that would be more helpful for me.
I really appreaciate your quick response.
Thank you very much.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
That would be something you will need to troubleshoot yourself. We do not troubleshoot user code.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/26/2012 Posts: 3
|
Ok, don't troubleshoot. But, I believe you can help me in changing cell color in red when validation gets failed. And kindly provide me one sample example for validating password field in Grid. I will do rest of the fields.
Hoping for the best.
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
imedx wrote:I believe you can help me in changing cell color in red. To change GridCell color, you will need to call this function: http://www.essentialobjects.com/doc/1/jsdoc.public.gridcell.overridestyle.aspxHere "style" is an CSS class name. imedx wrote:And kindly provide me one sample example for validating password field in Grid. I will do rest of the fields. You will have to do that yourself. That is your own business logic and we do not give samples for those cases. Sorry about that!
|
|