Ticket #10059 (confirmed Bug)
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
The code above did not pose the square brackets and single quotes around [ 'textCounter_${fieldName}' ]
To: