ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

SafeCracker can't wrap the <p> tag around WYGWAM and Matrix fields.

May 28, 2011 2:42pm

Subscribe [5]
  • #1 / May 28, 2011 2:42pm

    Shawn Dai

    76 posts

    This appears to be a little bug for SafeCraker 2.0 when using it with Wygwam 2.3.1 and Matrix 2.2.1 custom fields.

    Simple example:

    
        {field:custom_matrix_field}        
    

    produces this output:

    
        <div class="matrix"></div>        
    

    whereas it should be:

    
        <div class="matrix"></div>        
    

    Haven’t tried Playa, so dunno if there’s an issue there too.

    Other tags like <fieldset> and <div> seem to wrap properly around those fields.

  • #2 / May 31, 2011 5:13am

    John Henry Donovan

    12339 posts

    Shawn,

    Can you share the rest of your SC form please so we can try and replicate?
    What version and build of EE are you using?
    Are you using any other add-ons?

  • #3 / Jun 01, 2011 7:47am

    Shawn Dai

    76 posts

    Sure John,

    the form looks like this:

    {exp:safecracker channel="ee_channel" return="template_group/template/{member_id}/" entry_id="{segment_3}" allow_comments="no" hidden_pings="no" author_only="yes"}
        {status_menu}
            
                <label for="status">Status</label>
                <select name="status" id="status">
                    {select_options}
                </select>
                    
        {/status_menu}
            
                <label for="entry_date">Date</label>
                <input type="text" name="entry_date" id="entry_date" value="{entry_date}" maxlength="23" size="25" />
            
        {if textarea}
        
            <textarea id="{field_name}" name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}">{field_data}</textarea>
            
        {/if}
        {if textinput}
            <input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50"></p>
        {/if}
        {if pulldown}
            <select id="{field_name}" name="{field_name}">
                {options}
                    <option value="{option_value}"{selected}>{option_name}</option>
                {/options}
            </select>
        {/if}
        {if date}
            <input type="text" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50"></p>
        {/if}
        {if relationship}
            <select id="{field_name}" name="{field_name}">
                {options}
                    <option value="{option_value}"{selected}>{option_name}</option>
                {/options}
    
            </select>
        {/if}
        {if multiselect}
            <select id="{field_name}" name="{field_name}[]" multiple="multiple">
                {options}
                    <option value="{option_value}"{selected}>{option_name}</option>
                {/options}
            </select>
        {/if}
        {if checkbox}
            {options}
                {option_value} <input type="checkbox" id="{field_name}" name="{field_name}[]" value="{option_value}"{checked} />
            {/options}
        {/if}
        {if radio}
            {options}
                {option_value} <input type="radio" id="{field_name}" name="{field_name}" value="{option_value}"{checked} />
            {/options}
        {/if}
        
            {field:custom_matrix_field}        
            
        <input type="submit" name="submit" value="Submit" /></p>
    {/exp:safecracker}

    This is for version 2.1.3 build 20110411.

    I don’t have any other add-ons being used in this template. Let me know if you need a comprehensive list of what’s installed.

  • #4 / Jun 01, 2011 1:02pm

    Sue Crocker

    26054 posts

    Hi, Shawn.

    If you put in JUST the matrix field, does the same thing happen? I’ve seen something similar to this happen with Matrix.

  • #5 / Jun 01, 2011 4:03pm

    Shawn Dai

    76 posts

    Hi Sue,

    yes, it’s the same result if it’s only that field in the template.

  • #6 / Jun 02, 2011 11:21am

    Sue Crocker

    26054 posts

    Unfortunately I can’t replicate this using 2.1.3 build 20110411 and SafeCracker 2.0.

    Here’s the single matrix field I’m using:

    
    <label for="sc_matrixsingle"><strong>SC Matrix Single</strong></label>
        
    {field:sc_matrixsingle}
    

    Which results in:

    
    
    

    What I’ve done differently is add a label.. I do see divs in there being added by Matrix.

    See attached screen shot

  • #7 / Jun 02, 2011 3:16pm

    Shawn Dai

    76 posts

    I tried tags and a single matrix cell like yours with the template code

    
        <label><strong>Matrix Single</strong></label>
        {field:matrixsingle}        
    

    Sorta the same problem, except the label gets wrapped by the tags. Check the screenshots.

  • #8 / Jun 03, 2011 3:19pm

    Sue Crocker

    26054 posts

    At this point, all I can offer is to login and make a very basic form to see if the way I do differs from what you’re doing. Also since this a third party add-on, it might be time to go to Brandon (P&T) for help.

    check your email in a few minutes.

  • #9 / Jun 03, 2011 9:28pm

    Shawn Dai

    76 posts

    Sue, I haven’t received anything in my email.

  • #10 / Jun 03, 2011 11:11pm

    narration

    773 posts

    Shawn Dai, it looks like what Sue did that you didn’t is put the for=“fieldname” parameter into the label tag. This allows the label and the add-ons to know the label is associated with the field.

    Her result is what you want, so you might look carefully at the exact syntax, and try this.

    Regards,
    Clive

    happening to peek over shoulders here

  • #11 / Jun 05, 2011 4:27pm

    Greg Salt

    3988 posts

    Hi Shawn,

    Firstly, please do check your template just be using your browser show source and not Firebug or the Inspector - those tools can sometimes confusingly rewrite the HTML. Have you received the email that Sue sent (if it’s not been directed to a spam folder)?

    Cheers

    Greg

  • #12 / Jun 06, 2011 12:39pm

    Shawn Dai

    76 posts

    Hi Greg.

    I’ve checked this by viewing generated source via Web Developer extension for Firefox and also using X-ray with CSSEdit. All are showing what I described. I can’t just do the plain old “view source” because the source is being modified with JavaScript.

    I have received Sue’s email now. I’ll will respond to it shortly today ...

  • #13 / Jun 06, 2011 1:14pm

    Sue Crocker

    26054 posts

    Ahhh.. that’s another difference between the two of us.. no JavaScript extras here.

  • #14 / Jun 06, 2011 3:08pm

    Shawn Dai

    76 posts

    Hi Sue,

    just responded to your email and sent you a PM with some extra info.

    In regards to the JavaScript, there was nothing extra I was using when we were debugging beyond what the Matrix and WYGWAM add-ons use.

  • #15 / Jun 06, 2011 3:12pm

    Sue Crocker

    26054 posts

    Thanks, Shawn. I’ll be putting in my test code in a brand new template group just to stay out of your way.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases