I need to implement the HDIV concept. I have a page having input fields , which on tampering data is editable. The steps i found are not understandable.
I am using simple struts2 framework.
Related
How do I implement the CSFR security enhancement in my existing Grails project? I have read that I have to use token in form and modify the query string. I do not think it is best solution because in my project there are a lot of submit forms and many controllers.
The fact is you are going to have to change the way you submit forms and add in the token to each of the forms and change your controllers to check the token. If you want CSFR protection you'll have to touch all of those places.
Fortunately Grails offers useToken and withForm to help take care of the implementation for you. You just have to put it in where you want it.
You can read more about this in the documentation.
I need to create a multi-step wizard using ASP.NET MVC.
After thinking about this a while, I feel like the most efficient solution is to put the content for all my wizard steps in a single view, and just step through them by hiding and showing elements using jQuery.
But one area I'm not totally at ease with is MVC validation. How could I validate each step this way? Seems like I won't know for sure if the data is valid until the final step is completed and the entire page is posted back to the server.
Any suggestions?
You can validate individual controls using Validator.element(element) - see documentation here. An example of the approach I think you are taking is in this answer
I am looking at the HDIV framework to implement it in my Grails application. Looks like the framework is more user friendly to Struts/java based applications. They do say it can be configured on other frameworks. This is what it exactly says:
It is possible to use HDIV in applications that don’t use Struts 1.x, Struts 2.x, Spring MVC or JSTL, but in this case it is necessary to modify the application (JSP pages).
I see that we need to modify the editable and non editable data being sent to the server (one of the strategies is to cypher code the hidden field and add a state parameter to link urls.)
And in the response we get back this data and use a validate() function to do integrity checks.
The sample grails-HDIV project on GITHUB is really basic with no details.
Has anyone implemented it on grails?
Thanks
Priyank
I've just written a plugin for this very thing. I'll see if my company will let me release it and if so I'll inform you.
Is there a reference available of the html validation attributes for cases where we want to use unobtrusive client side validation without using Data Annotations?
Thanks,
Ben
I don't think you will find a reference for this but if you are not going to use Data Annotations I would simply recommend you hooking up the jquery validate plugin manually.
We unfortunately had to do this recently, since only the view was under our control. Since the unobtrusive validation is really meant to be used in conjunction with data annotations, you probably won't find documentation online for how to use them separately.
We found that the easiest thing to do was to create a spike project, and add the correct data annotations to some test model, create a simple "EditorFor" view for it, look at the generated HTML, and copy over the data attributes that ASP.NET MVC added to the text boxes.
I am wondering what methods people are using for validating check boxes in ASP.NET MVC (both client and server side).
I am using JQuery currently for client side validation but I am curious what methods people are using, ideally with the least amount of fuss (I am looking for a new solution).
I should mention that I am currently using MVC Preview 4, and while I could upgrade to MVC Preview 5 if there is no elegant solution in MVC Preview 4, I would prefer not to at this stage just for compatibility purposes with other developers and existing solutions.
Note, I have seen these related posts:
Validating posted form data in the
ASP.NET MVC framework
What’s the best way to implement field validation using ASP.NET MVC?
MVC.net JQuery Validation
If you go on to the validation website and download the whole package that included the demo files, you can find the one with example of validating check boxes and radio buttons.
The link is here:
http://jquery.bassistance.de/validate/jquery.validate.zip
I assume you simply check whether or not the name of the checkbox was posted to the server or not. Not being an ASP coder myself, I can't help, though this is how it would be done in PHP (of course, depending on how you map validations).
<?php echo isset($_POST['checkbox_name']) ? 'checked' : 'not checked'; ?>