I am trying to add a rich type for a four-digit year and provide an 
in-place editor for it.

The problem I am having is that the editor never activates, apparently 
because an ID is not generated.

The *type definition* is very simple:

class NthpYear < Integer

  COLUMN_TYPE = :integer

  HoboFields.register_type(:nthp_year, self)

  def validate
    "Your entry for year is too long: It must have four digits" if length > 
4
    "Your entry for year is too short: It must have four digits" if length 
< 4
  end

  def format
    self
  end

  def to_html(xmldoctype = true)
    self
  end

end

The *editor definition* is just:

    <def tag="editor" for="nthp_year"><%= in_place_editor(attributes, this) 
%></def>

The *DRYML* for the form looks like this, for the two relevant variants of 
question_type:

(the section that generates a working editor)

<div part="tc" id="tc-#{typed_id}" if="&this.question.question_type.name == 
'short_text' || this.question.question_type.name == 'long_text' ">
<b>Enter text:</b> <editor:response_data update="tc-#{typed_id}"/>
<br/>
/div>

(this section generates an editor lacking an id, so it never activates)
<div part="ny" id="ny-#{typed_id}" if="&this.question.question_type.name == 
'nthp_year'">
<b>Enter the year:</b> <editor:response_year update="ny-#{typed_id}"/>
<br/>
</div>

And the generated *HTML* sections are:

(working editor with id)

<div class="text response_response_data editor in-place-edit 
model::response:53:response-data update::tc-response:53 view 
response-response-data " hobo-blank-message="(click to edit)" 
hobo-edit-text="test edited" id="uid1" title="Click to edit">test 
edited</div>

(non-activating editor, lacking id)

<span class="nthp_year response_response_year editor in-place-edit 
model::response:54:response-year update::ny-response:54 view 
response-response-year " hobo-blank-message="(click to edit)">(click to 
edit)</span>

Any insight into errors in my DRYML, type, or editor definitions, so I can 
get my editor working?

Thanks!

    

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/hobousers/-/wAij6nJR6nYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to