tags:

views:

30

answers:

2

Hello

I have a field on my form, which I'd like to parse before sending to a Web server. Is it possible by using C functions provided by the web server?

I mean, suppose I have parse_field() function written in C, and the web server knows it and can call, so I do something like <% parse_field() %> on the page, the function shouls take the current contents of the field as an argument and return some parsed value, which will be POSTed to the server.

Is it possible, or not by all means? Or it is better to do with JavaScripts function (but I'm not very good with JS though :( )? Thanks !

A: 

I'd suggest JavaScript, since it is server sided. Maybe you are trying to validate something? Have a look at this: http://flowplayer.org/tools/demos/validator/index.html

+3  A: 

Is this classic ASP?

I wouldn't rely on Javascript for validation. You can't assume that everyone has JS enabled. You should implement server-side validation for graceful degradation, and then implement JS for client-side validation.

George
Agreed. However, I use Javascript as the first validation layer, followed by bean validation.
@GeorgeI don't clearly understand your point: after data have been POSTed, they're validated on the server side, and somehow the client is notified about the result of validation, then ... what's next?
Mark
@Mark - I was just pointing out that Javascript is a client-side language - and thus is completely out of your control as a web developer. You cannot assume that all clients have Javascript enabled, and so if you are not performing validation on the server-side, bad data might make it through to your server which would be a significant security issue. The main reason I was saying this is because erlord was suggesting Javascript is server sided, and I corrected him - it isn't. Hope that helps?
George
Thanks George, it's clear now! Will be going the server-side validation.
Mark