I have discovered the real culprit, but I'm still trying to figure out why 
it's breaking things: 

I have some javascript which watches that pair of radio buttons (Yes/No), 
and when "Yes" is chosen, it is supposed to reveal a set of check boxes for 
a number of symptoms. The problem is caused by my hiding those symptoms by 
default (I have some javascript which performs the hide upon loading). 

Here are the lines from the javascript function which seem to be causing 
peppercorn some trouble: 

$("input[type='radio'][name='preopsym_yn']").closest("div").next().attr("name", 
"preop_symptoms")
if (!$("input[type='radio'][name='preopsym_yn']")[0].checked)
    $("div[id='item-symptoms']").hide();


So, I'm assuming that the marker that the error is referring to is related 
to the div.item-symptoms. 

I'd love to hear how experienced deform users do things like hiding these 
divs on load by default. 

On Friday, December 12, 2014 11:18:59 AM UTC-6, Eric Torstenson wrote:
>
> I have a relatively large form that I've recently been playing with to try 
> and get more control over the layout and behavior. After some recent 
> changes, I started getting a peppercorn exception"ValueError: Not enough 
> end markers" on parse(controls) in field.py. 
>
>  The code that causes the problem is: 
>
> preopsym_yn = colander.SchemaNode(
>     colander.String(),
>     title='Preoperative Symptoms?',
>     description='Select Yes to reveal symptoms',
>     widget=treat.models.widgets.RadioChoiceWidget(values=YES_NO, 
> css_class='preopsym_yn'),
>     oid='preopsym_yn'
> )
>
> If I change that oid, the error goes away, but it doesn't collide with 
> another widget id (explicitly named or not). 
>
>
> My Widget is fairly simple, I just made some minor changes to the template to 
> allow explicit control over it's appearance: 
>
> class RadioChoiceWidget(deform.widget.SelectWidget):
>     """
>
>     """
>     template = 'treat.views:templates/widgets/radio_choice.pt'
>     readonly_template = 
> 'treat.views:templates/widgets/readonly/radio_choice.pt'
>     css_class="toggle"
>
>
> And the template look fine too: 
>
>                      style style|field.widget.style;
>                      inline getattr(field.widget, 'inline', False);"
>          tal:omit-tag="not inline">
>       ${field.start_rename()}
>       <div tal:repeat="choice values | field.widget.values"
>            tal:omit-tag="inline"
>            class="radio">
>         <label for="${oid}-${repeat.choice.index}"
>                tal:define="(value, title) choice"
>                tal:attributes="class inline and 'radio-inline'">
>           <input tal:attributes="checked value == cstruct;
>                                  class css_class;
>                                  style style;"
>                  type="radio"
>                  name="${oid}"
>                  value="${value}"
>                  id="${oid}-${repeat.choice.index}"/>
>           ${title}
>         </label>
>       </div>
>       ${field.end_rename()}
>     </div>
> </div>
>
>
> I don't personally understand what peppercorn is yet, so I don't understand 
> the error message at all. 
>
>
> Any thoughts? Also, this is a lot more complicated that is probably typical. 
> However, if you want better control over the layout of your widgets, is this 
> the right way to approach it? 
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to