Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages<12
HTML Form features
Baseless
#21 Posted : Monday, July 26, 2010 6:56:20 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
Quote:
The validation rules are stored against a ValidationSet schema which has ValidationRule child content. So the rules are just normal Kooboo content accessed by the API.

I suspected something like that but havent tried it at all, thx for clearing it up!

Regarding validation: You mean that the jquery validation will tell the pageplugin what faults via get/post that are encountered wich then te plugin service stores it in tempdata(The following if im correct in this assumption, otherwise just ignore me ;) )?
If its just some front end validation to help the user that would be ok, but wouldnt that be very vulnerable to form injections if used as primary serverside validation?

The problem i have had(our earlier discussion regarding singletons etc) is that i was trying to use custom model validatorattributes thus hoping to be able to use the built in clientside validation functionality without writing alot of code. I normally (webforms) build servicelayer style/like server validation but my hope was to connect the attributes in the end both to the kooboo admin rules and getting error messaages from kooboo text resources. Then just activate client side validation just by setting the clientsidevalidation tag in the View.

My backup plan was to implement ordinary servicelayer validation then setup some webservice to supply jquery with a way of checking against the same validation that is being used at postback on serverside(or perhaps binding it with xval, never tried that either but ppl seem to like it so..).
Anyway my hope was to not being forced to write any code supporting clientside validation at all but just writing the serverside validation and then 'turn on' clientside.

PS: I thought a bit regarding jquery-plugin and perhaps it would work if some kind of hash was generated by the webservice when form is valid and the compared to the form being sent at postback to confirm that the same form was sent as the form that was validated? Then the user wouldnt be able to send the form with js disabled on the browser either.
GazNewt
#22 Posted : Monday, July 26, 2010 7:24:40 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 2/2/2010(UTC)
Posts: 122
Location: England
The way it works is that you define your validation rules against the validation set schema, you have one rule per input control eg; is required, min number, max number, min length, max length, regular expression, is number, is email etc.. You give validation sets names. To get client side validation you add a Validation module component to the Kooboo page and that's it, it wires it up at the front end for you. This works, just a few more tests and tidying then it's done (first phase anyway), it stops the user submitting the form if it is not valid, works nicely

Server side validation is completely separate. In fact server and client side validation are both optional, you can have both, one of them or none. To get server side validation you simply add a validation module plugin to the page and it performs validation checks using the rules you've set. There is no communication from client to server, they are separate.

I'm doing the server side validation tomorrow I haven't started that yet, this will be easier than client side so I should get it done then.

One thing that might not make it into phase 1 is localization but if I see a quick win I'll do it. The Jquery validation plugin has some built in error messages but I'm sure there will be a way of overriding them if I look into it

I've finished my updates to the html form module as well, but I'll make them available together when I'm done
Baseless
#23 Posted : Monday, July 26, 2010 1:51:03 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
Quote:
Server side validation is completely separate.

That was what i was uncertain what you meant but then its no problem. Havent tested admin validation but i guessed something like that. And keeping them optional is nice.
GazNewt
#24 Posted : Wednesday, July 28, 2010 8:14:58 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 2/2/2010(UTC)
Posts: 122
Location: England
The initial changes to the HtmlForm module and the new Validation module are complete.

HtmlForm module

- Email CC and BCC
- Email SSL so it now works with GMail, Yahoo! etc.
- Email failure Exception logging
- EmailSent true|false flag on content item
- Added new optional render mode that uses MVC views (so you can tweak html output if necessary without recompilation)
- You can now setup html to appear before and after the form
- The new View render mode automatically picks up errors from the Validation module and redisplays the form

Validation module

- Module plugs into a page with three entry urls.

/default/ClientValidationHeadTags/ - Renders jquery script tags required by client side validation
/default/ClientValidation - Renders custom javascript that performs client side validation
default/ServerValidation/ - Performs server side validation

- Validation rules are setup in a content folder you must call Validation.Set
- Validation options are

Is alphabetic
Is alphanumeric
Is data
Is digits
Is email
Is number
Is url
Minimum/maximum number
Minimum/maximum characters
Field must be equal to another field
Custom regular expression with custom message

- For server side validation all built in regular expressions and error messages are stored as text resources
- Can halt error checking after a specific error if desired


Note: I didn't want to store the validation rules as content items but I gave up trying to get the ExtJS form working so I couldn't use the module Admin button approach. I was going to use JQgrid instead but decided to just use content items instead.

Note: Server validation was going to be a plugin but there is no unhackable way of passing the validation set names into a plugin.

Note: You may suspect divitis if you look at the rendered form html but in my experience the approach I've used allows for the greatest amount of flexibility via css. Each customer wants it to look different and it's helpful to be able to tweak css rather than core module files to get what they want

Note: This is not ready for production use yet as it needs some more testing but it's at the alpha stage. Please help me break it!

Note: The Validation module is not tied to the HtmlForm module, essentially it adds a Dictionary<string, string> to the TempData collection that other modules can pick up. I've changed the HtmlForm module to pick the errors up but validation is not limited to this module. Anywhere where you are accepting input from the user (or in the request from any source into a Kooboo page) can use the Validation module.

I have created a version of the Small Business site package with a contact form that uses the Validation module.

Well I hope this is going to be useful to somebody, it's useful to me at least!

At the moment I don't have anywhere to host the files, they're 44MB in total and a bit large for email, can anyone help?

UPDATE : You can get the files here http://cid-e2ac88168dffefb6.office.live.com/browse.aspx/.Public
Baseless
#25 Posted : Wednesday, July 28, 2010 6:15:51 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
I could host it on my testserver as a temporary solution. I host it on my own connection, use it for a few small sites and dev sites. Since its hosted on a ordinary sitynetwork connection i give no promises what so ever regarding uptime etc.Though perhaps it could be used until you find a better solution?
GazNewt
#26 Posted : Wednesday, July 28, 2010 6:25:23 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 2/2/2010(UTC)
Posts: 122
Location: England
Do you have a dropbox account? I can share a folder on my dropbox so people can access it, but you need a dropbox account and I need to share it with you manually which means people who want to see/use it would have to ask me, which isn't ideal

Alternatively are there are free file sharing sites you recommend? Would be easier to just post a link. In the next few weeks I'll be setting up my personal site so I can host there and blog about how to use the module
Baseless
#27 Posted : Wednesday, July 28, 2010 6:36:58 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
I have a dropbox account but dont really use it. Thoug its just for you to send me a link to the files if i am to dl them there?
Regarding filesharing sites perhaps something like piratebay but requires people to install torrent clients.

If not store on http i would think perhaps rapidshare or something like that would work better. You can check it out if you like, if you want me to help you share it on http until you get your own site up then just give me access via dropdox and ill publish it.
GazNewt
#28 Posted : Wednesday, July 28, 2010 6:48:17 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 2/2/2010(UTC)
Posts: 122
Location: England
Ah wonderful, Microsoft SkyDrive lets me share files on a public folder :

http://cid-e2ac88168dffefb6.office.live.com/browse.aspx/.Public

Can you access them?

I've only included the source code, to get the two modules as installable Kooboo modules you need to unzip them and zip up the files rather than the root folder. Validation.Core is a supporting project not a module
Baseless
#29 Posted : Wednesday, July 28, 2010 6:58:27 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
Seems ok to me!
GazNewt
#30 Posted : Wednesday, July 28, 2010 7:56:25 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 2/2/2010(UTC)
Posts: 122
Location: England
Good I'm glad thanks Microsoft! I've updated the original to include the link. Tomorrow I am going away until sunday so if anybody does actually download it and has issues I only have a bit of time tonight to support and then I'm offline until sunday.

Offline for three days aaarghh!
Baseless
#31 Posted : Thursday, July 29, 2010 8:03:39 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
;)

Btw i peeked in your model..

"NastyGlobalFilthIsThereABetterWay.CmsContext"

Describing Names are fun arent they? ;)

Atleast im not alone with that problem, atlthough i use HttpContext.GetCmsContext() instead, but feels equally sad ;).
Users browsing this topic
Guest
2 Pages<12
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.465 seconds.