• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Input field processing

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all, and welcome Frank,

I'm working on a Servlet+JSP based project where we're making some use of AJAX, and additional use of Javascript for input validation and other processing.

I have two concerns I'm addressing right now, and was wondering if this book would help in these areas.

One is: I don't seem to have the same grasp on focus, caret/cursor position, and current text selection that I do with full client Java. Of course it's different, and I'm running into browser differences too, e.g. selectionStart/selectionEnd vs. document.selection.createRange - so I'm not currently getting this right. I'm trying to programatically insert/replace characters in the current field in response to certain events.
Do you cover these issues? Anybody have a good online resource that could help me learn this better in the meantime?

The other big issue I'm dealing with is performance vs. input validation. I'm already using a toolkit (Dojo) to help with this, but in the client GUI world I'd do things like prevent even entering (typing, pasting) invalid data in fields, and keep the OK/Submit button disabled until the whole form was valid (minimally, all required fields have values).
It seems I could do this in Javascript but performance has started to seriously degrade as I've been adding bells and whistles. Any good strategies to share in this area, and do you address performance issues in the book?

Thanks for taking the time to be here with us,
Stephen
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stephen,

I do indeed have an entire chapter dedicated to client-side validation, although probably not exactly what your talking about: it's a project to build a non-intrusive validation framework along the lines of Commons Validator in many ways.

As for performance, yes, there is some coverage of that as well, although in a more generic Javascript sense.

My advice would be to look for a good library that suites your needs. We're evaluating WiseBlocks at work right now and it looks very promising. We're also using Dojo, although not for validation.

I like Dojo, but it does seem to suffer from performance issues at times. I think its a case of being a little too clever for its own good... it's sometimes a little bit overengineered in my opinion.

The best advice, as with any type of optimization, is write your code to work, then little by little chip away the aspects of it that is hurting performance. That isn't always easy with client-side coding, but it's a necessary step in any complex app.
[ May 02, 2007: Message edited by: Frank Zammetti ]
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephen,

You said -

It seems I could do this in Javascript but performance has started to seriously degrade as I've been adding bells and whistles.



I guess the client we are talking about is the browser. Right? The only way, I'm aware of, to validate on the client side is via JavaScript... are you speaking about performance problems on the client side?

Regards,
Dan
 
Stephen Paulsen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frank, and I feel much the same about Dojo as you say. I chose it here because some of its widgets so perfectly suited to what we're doing on this current app.

Dan - yes the client is a browser and I'm using Javascript. The performance concerns are on the client side, because validation isn't the only thing the Javascript is doing.

As more and more Javascript goes in I've seen performance slow down. After some strategic changes* performance is still good now (better than "acceptable") but it has become something we need to keep an eye on.
I'm considering how far the validation can go beyond testing that required fields are present, and the impact it will have on performance.

I was hoping the book might cover those topics and it sounds like it does.

Thanks for the replies,
Stephen


(*) for example, we moved the drag-and-drop reording of records to it's own task page since it's fairly heavyweight, and with all the other features in the main page the dragging became "jittery".
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephen,

JavaScript validations are by nature very light. So, it's hard for me to imagine how the validations can contribute to performance issues.

I believe that you, or anyone who develop such applications, should inspect carefully every character and every logical entity the user entered. The client side is the perfect place to start taking care of the user input.

From my experience, it's never too much.

Regards,
Dan
 
reply
    Bookmark Topic Watch Topic
  • New Topic