Ticket #10059 (confirmed Bug)

Opened 6 years ago

Last modified 4 years ago

Archetypes widgets textarea.pt textCounter issue and solution

Reported by: pdwpackrat Owned by: nouri
Priority: minor Milestone: 4.x
Component: Archetypes Version:
Keywords: textCount, onkeyup, onkeydown, keypress, textarea Cc:

Description

I've installed Plone 3.3.2, and recently the PloneFormGen.

An issue I noticed was with the textCount for the TextArea field.

The issues was related to the way Plone generates the file names using the "-" instead of using "_" for spaces and the string assigned to keypress JAVASCRIPT generated.

This generated teh incorrect javascript to access the TEXTAREA filed by name keypress generated the string was

this.form.textCounter_some-text-field-name

which would be the same as

this.form.textCounter_some - text - field - name

Which is the incorrect syntax for the onkeyup/onkeydown

I've implemented a fix, and thought you might use it.

The FILE I updated: .../Plone-3.3.2/buildout-cache/eggs/Products.Archetypes-1.5.13-py2.4.egg/Products/Archetypes/skins/archetypes/widgets/textarea.pt

Line Changed: FROM:

keypress string:textCounter(this, this.form.textCounter_${fieldName}, ${maxlength});">

To:

keypress string:textCounter(this, this.form.elementstextCounter_${fieldName}?, ${maxlength});">

Or I could have used the getElementById , something like

keypress string:textCounter(this, document.getElementById('textCounter_${fieldName}'), ${maxlength});">

Other then my copy getting over written with an update, are there any know issues with

Change History

comment:1 Changed 6 years ago by pdwpackrat

The code above did not pose the square brackets and single quotes around [ 'textCounter_${fieldName}' ]

To:

keypress string:textCounter(this, this.form.elements[ 'textCounter_${fieldName}' ] , ${maxlength});">

comment:2 Changed 4 years ago by kleist

  • Status changed from new to confirmed
  • Keywords textCount, onkeyup, onkeydown, keypress, added; textCount onkeyup onkeydown keypress removed
  • Version set to 3.3

comment:3 Changed 4 years ago by hannosch

  • Version 3.3 deleted
  • Milestone changed from 3.3.x to 4.x

The onkey code is still the same as mentioned in the "before" patch of this report, so this is likely still an issue.

Note: See TracTickets for help on using tickets.