On Fri, Jan 12, 2018 at 5:46 PM, Craig Russell <apache....@gmail.com> wrote:
> I've roughed in the discuss page and it has a few issues that I can't figure 
> out.
>
> 1. The discussBody field doesn't quite work. Initially the focus should be in 
> the field but I think there is some code missing.

document.getElementById("discussBody").focus()

This requires an element to be defined with an id attribute with a
value of discussBody.  This either can be done by adding

  id: 'discussBody'

or  adding .discussBody!, thus: _textarea.form_control.discussBody!

Note: in this one, the javascript console is your friend.

> 2. The discussBody form doesn't seem to set the @discussBody field. I have a 
> bit of debugging and the variable never is set.

Changing "onChange" to "onInput" will fix this:

https://developer.mozilla.org/en-US/docs/Web/Events/change
https://developer.mozilla.org/en-US/docs/Web/Events/input

Note: this may have been a holdover from the original React.js
implementation, which defines its own events.  Vue.js uses the
standard browsers event.

Also, I've seen cases where early errors (such as the one
getElementById one above) prevents the code getting to the point where
it adds the event handlers.

> 3. The Submit comment button never enables. It should enable when the 
> discussBody field is set to non-null.

Fixed by the above two changes.

> 4. The \n in the discuss comments show up as is. How do I get control 
> characters like \n to behave?

Try double quotes here: 'We could do better\nMuch better'

See: https://docs.ruby-lang.org/en/2.0.0/syntax/literals_rdoc.html#label-Strings

> Any comments on the bugs or on the form design or implementation are welcome.
>
> Craig L Russell
> Secretary, Apache Software Foundation
> c...@apache.org http://db.apache.org/jdo

- Sam Ruby

Reply via email to