|
Posted by Whit on 11/27/75 11:57
Here is the problem in a nutshell:
Think about a company name. It should have capitalized names, like:
Bella's Sandwich Shop.
I want to help the lazy user toward that structure so that if they
never cap, or worse, keep the caps lock on, then it will be entered
correctly.
However:
Sometimes things shouldn't be managed in that way, like:
Bob's Adult Video XXX.
The formatting must be turn-offable so that doesn't become 'Xxx'. So my
goal is to create this field which auto-corrects, but that people can
turn off if it becomes annoying. Also I would like to avoid server load
and the trouble of refreshing. I pictured a Word-like assistance in
formatting. (Except that it is easy to turn off ... :D)
-- whit
Harlan Messinger wrote:
> Whit wrote:
> > Alright -
> >
> > Although I don't entirely understand the onkeypress event handler,
> > here's what I think I have ... It appears that when you include a
> > return statement in the call, a true/false return value will
> > allow/prevent the value from appearing, respectively.
> >
> > However, in my case, when a letter is pressed, it is not only that
> > letter that may need to be changed. Consider the folling example:
> >
> > The user types:
> >
> > Acute dog
> >
> > And realizes they have mistyped. They then insert a space between 'A'
> > and 'cute'. This should change the 'c' to a 'C', even though it was not
> > the key that was pressed.
> >
> > To this point I have accomplished this by formatting the whole line,
> > the setting the value of the field equal to it. This screws up the
> > cursor. In our previous example, after the space is typed, the cursor
> > should sit here:
> >
> > A |Cute Dog
> >
> > But the assignment causes it to forget the cursor position.
> >
> > A Cute Dog|
> >
> > Making insert-typing very difficult. How can I use onkeypress to solve
> > this? Can I change specific characters instead of just rewriting the
> > whole line?
>
> I'm curious about the bigger picture, and about why it would be
> desirable to have the transformation occur while the user is typing. Why
> not just convert it at the server when the form is submitted? Is the
> idea that you expect the user to type a whole sentence, and you intend
> to correct it? What is someone types "my name is bob becker"? Is
> converting it to "My name is bob becker" going to be satisfactory? Will
> you add a period on the end if the user omits it?
Navigation:
[Reply to this message]
|