|
Posted by Harlan Messinger on 11/27/77 11:57
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]
|