GWT simple form validation example - validation

I'm looking for nice and fast way for validating forms in GWT, that can display errors one by one, focusing on the offending field. I've found gwt-validator and gwt-validation, but their documentation lack of examples.
Thanks for help

Try the Hupa source code, If I remember well they use a GWT validation framework. Hupa is an open source project from Apache.

Related

Watin and Telerik Controls

I would like to ask if anybody knows an easy way to test Telerik controls with Watin.
We are about to start using it but before we do I wanted to see if there is anything I would need to know.
The problem that I can see we will be having is that if even smallest thing changes then all our tests will also break.
Any suggestion is greatly appreciated.
The problem that I can see we will be having is that if even smallest thing changes then all our tests will also break.
This could/will be true of all portions of your pages, including Telerik controls, depending on your test structure. Ideally, your elements will have IDs assigned and you'll use Page classes and custom control objects to remove all HTML references from your actual test code. Then if something changes on the webpage (or in a control), you verify the change is expected, then you change the WatiN page code (or control code) and re-run your tests.
The WatiN page class primer is here: http://watinandmore.blogspot.com/2009/06/introducing-page-class.html
Basically, you want to have your test code look like myPage.PickDate("3/29/2012") and not like ie.Tables[3].TableRows[2].TableCells[4].Textbox(Find.ByClass("datePicker")).TypeText("3/29/2012")
Changes can, do and should result in failing tests, however, I can attest that with a good page (or control) class setup that abstract away the HTML DOM and other specifics leaving non-HTML-filled test code, means that when changes do happen they are most often easy to get working again.
Note: Selenium also has a Page class concept, but I have not used it very much as of right now. Bottom line: If you write a lot of tests that reference the HTML DOM directly in test code, you're setting yourself up for a maintenance headache regardless of if you go with WatiN or Selenium or whatever.
Added: As to your original question: Can you work with Telerik controls in WatiN? Yes you can most likely, but depending on the control you may need to get a bit creative, possibly even calling javascript methods from within your test (page object ;) ). I've been stumped by a couple controls (non-Telerik) but most I've eventually figured out.
I realize you asked about WatiN, and I know I'll probably get downvoted into oblivion, but I might recommend Selenium instead. It seems to be more widely used and when we were evaluating the two we found Selenium easier to work with because of the Firefox plugin to record/generate the tests. This meant that our non-technical folks could set up the tests.
Since then we've successfully used Selenium to test ASP.NET sites that utilize Telerik controls. I only ran into one issue, with the RadNumericTextBoxes, which I've documented a fix for here: http://www.msigman.com/2012/02/entering-radnumerictextbox-selenium-webdriver-1-6-0/.
I'm currently in the process of writing a how-to guide for doing it: http://www.msigman.com/2012/03/automated-testing-asp-net-web-application/ (shameless plug).
You should also consider evaluating Telerik's Test Studio, our functional automation test tool. (Disclosure: I'm their evangelist for Test Studio.)
Test Studio really shines when you're working with Telerik controls. You'll get some great additional functionality around being able to dive deeper in to verifications and actions around the controls.
Even more importantly, Test Studio handles centralizing locators and pages by default, so you don't need any additional effort to best manage your UI changes.

playEditor app Gwt Validator

I was looking at the playEditor app to learn and the app loads up but the validator does not work after the first time.Do you have an updated version?
If you mean my little (intentionally unpolished) example from this post: GWT 2.1 Editors framework - no, I don't have an updated version.
The problem was, that once the validation passes, it stops working. I believe, the way the Editor framework is/was meant to be used (at least with GWT 2.1) is that you close the editor Dialog/Panel/..., as soon as the validation is correct. When you want to use it again after that, you'd have to create a new Dialog (where validation works once again).
This is actually one of the main reasons, why I'm currently not using the framework. I often prefer re-usable forms over closing dialogs, so it didn't seem ideal for me.
Note that I haven't made a new attempt for GWT 2.2 - and maybe I didn't try hard enough even for GWT 2.1 - so I would be glad, if someone finds a solution!

ASP.NET MVC2 Rich Text Editor

basically, my question is pretty much similar and has been asked numerous times. Which WYSIWYG editor is better now that Telerik has released their MVC editor, would it be wise to purchase the entire suite instead?
Selections:
TinyMCE
CKEditor
Telerik MVC Editor
Disclaimer: As part of the Telerik MVC team (and one of the editor developers), my opinion is quite biased, yet I can shed some light on the differences between the editors.
All of them are open source
Despite Todd's answer, the Telerik MVC editor is open-source, under GPLv2 license (with a commercial license available). Our support is well known, so I guess this is where we stand out (though it is paid). On the other hand, both TinyMCE and CKEditor have huge communities, which may help quickly, too.
Different feature set
This has been the first release of the Telerik MVC editor, while CK and TinyMCE have been around the block for a very long time. We have mixed feelings about this -- while we are missing out on quite a few tools/features, we have invested a lot of time in polishing the existing ones (converting list items to headings, pasting from MS Word). Our bet is on cleaner, more robust code (4k LoC vs 14k LoC in TinyMCE without plug-ins).
It depends on your requirements
After all, with the Telerik suite, you get... well... a suite of components with common code and themes. So if you need the dedicated support and the other components and the limited feature set does not make a difference, Telerik would be a nice choice. If you need a full-scale editor and want to bet on more feature-complete products, TinyMCE and CKEditor are the wiser choice.
I hope this helps and does not contain much happy talk.
Some Background:
While there are some very good third-party components for ASP.NET I tend to stay away from them for the open source alternative. The reason goes back to an issue I has with a chart component a few years ago. It had a bug that the company would not fix in the current version and instead wanted us to purchase an upgrade while not guaranteeing that would fix the problem.
They did offer a demo that we could not use in production (which was the only place we were getting the problem) so the problem continued until the component was replaced.
My Answer
From My experience I would recommend going with the open source alternative. I have used CKEditor and TinyMCE with success in PHP projects. CKEditor can be styled nicely and TinyMCE has tons of documentation from the millions of people who use it daily.
The greatest benefit to open source is being able to change the code to meet your needs or fix a problem specific to your environment.
My last ASP.NET MVC app required all components to be open source for the same reason as mentioned above with the end result being more stable than the previous that included some purchased components.
Hope this helps.
Wordpress uses TinyMCE, so I am very familiar with using it (though getting it to look like wordpress is a little bit of an undertaking).
I have successfully implemented TinyMCE into 2 of my Asp.Net MVC websites with very little effort.
As with any, there is a ramp up time, but TinyMCE has never disappointed me.
We are using CKEditor_3.x in our MVC 2 app.
It works great.
On save:
Just 1 important note, in your CKEditor config file be sure to set:
config.htmlEncodeOutput = true;
Or you will get an error message.
Later on display
You will need to decode is like:
<%=HttpUtility.HtmlDecode(Html.TextAreaFor(model => model.Description).ToHtmlString())%>
Good luck!

Is ajax4jsf dead? What other AJAX libraries for JSF are there?

I am currently using the JBoss RichFaces JSF component library for the project I am working on. It works quite well in general, especially the AJAX support provided by ajax4jsf (A4J), but I find the usually very inflexible table-markup used for almost every component and all this "skin" stuff of RichFaces quite annoying. It would be nice if there were some components which just provided the functionality and only minimal markup/style. Originally I had planned to use ICEfaces, but that didn't work too well either and also brings a lot of predefined styles with it, so for now RichFaces seems to be the best option.
Now I thought it would be nice to develop a clean tag library which provides some useful components found in RichFaces, ICEfaces or Tomahawk (not all of course!), which don't use any predefined style and generate markup which can be styled easily with CSS.
I wanted to use the ajax4jsf library for AJAX support, because I think it works quite nicely, and integrates seamlessly into standard JSF with facelets. But it seems that since it has moved over to JBoss, it isn't available as a standalone library anymore. You can only download the whole RichFaces package, which I don't want.
Is the ajax4jsf (A4J) project dead? If it is, what alternatives are there?
You can find many alternatives here:
JSF AJAX Component Library Feature Matrix
If you read the ajax4jsf forum you'll see that it's been merged with Richfaces.
You don't have to use the Richfaces components on your page, so do you have an issue with having the JARs in your project?
I agree that many JSF components (not just Richfaces) are based on tables (eg. h:selectManyCheckbox). Don't forget that it's easy to write a new renderer for many of these. I've done this for the h:selectManyCheckbox so that the checkboxes are rendered inside divs instead of a table. I would think that you should be able to do the same for Richfaces components...but if that's the case, then why use them?
You may find it easier/nicer using jQuery UI elements and tie them back to your Beans with a4j:jsFunction (or similar).
Just a comment. I started using icefaces. I'm a web designer also and im very particular on look and feel of the icefaces components in relation to my web application. I was highly frustrated at the time it took me to override the look and feel of icefaces components using css. The components had a lot of nested table markup that annoyed me.
When i moved to richfaces. I discovered it was alot easier to override the look n feel because richfaces have an integrated system of overriding the look n feel in css. The css given to the components had similar and sensible class names that made it easier to predict and override.
If you are feeling adventurous, take a look at JSF 2. It features a shift in view technologies from JSP to Facelets and built in AJAX support. David Geary has been running a series of JSF 2 fu articles on developerWorks (though you'll have to wait for part 3 for the AJAX stuff). Ed Burns and Jim Driscoll have been demoing various features during the development of the new API, so you might want to check out their blogs too.

xHTML markup checker integrated in Selenium

Recently, I thought about how can I improve the quality of the projects, by using Continuous checking of xHTML source at Continuous Integration machine.
Look, we have a project
http://sourceforge.net/projects/jtidy - jTidy
JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty printer.
It can validate the xHTML through a command-line interface. Or this tool can be extended in the way we need, because all source code are open.
We can overwrite every Selenium validation method, such as assertTextPresent, or any other, so it will be calling the jTidy(by providing current state's HTML source), and if some errors or warnings will occur - it can be saved to Continuous Integration machine build's logs - so any project's related can see this info.
We can not to rewrite all the Selenium methods, to integrate this call on every step, but to make this calls where we want(after DOM manupulations).
Yes, we can use W3C markup validators for our sites, but there isn't any possibility to validate not initial state of page's source with this validators. After page creation, there might be lots of DOM manipulations which can produce markup errors/warnings - we can find it immediately with this scheme.
One of the benefits of using Continuous integration is that you have quick feedback from code - how it integrates with existing code base, test whether unit and functional tests pass. Why not to get an additional useful info, such as instant xHTML markup validation status. The earlier we identify the problem, the easier to fix it.
I haven't found anything on this theme in google yet.
And want to know, what do you think about this idea?
Seems like a worthwhile idea.
I've done two similar things with CI before:
I've used Ant's XMLValidate task to validate static xhtml files as part of the build process
I've used httpunit to pull pages that I then parsed as xml
But the idea of tying into Selenium to validate the content inherently during a functional test run is novel to me.
I think, that idea is brilliant but it is very hard to implement it from scratch.
But this idea is like evolution of build/quality validation process, so it will be released as ready-to-use tool with documentation someday.
Good idea! - in fact I just had exactly the same idea and was just checking to see if anyone had done it before - argh! Looks like you beat me to it :)
I was thinking along the lines of capturing and auto-submitting each page hit by selenium to the w3c HTML and CSS validtors (by file rather than link so state is held) - failing on any errors. I like the jtidy idea though.
Great in principle, but I'm not quite sure how to call it from Selenium. I'd love to see documentation explaining how to run it from Selenese, or from PHPUnit.

Resources