2 instances of WYGWAM inside a single Matrix cell
Posted: 06 January 2011 01:03 PM   [ Ignore ]
Wallflower
Rank
Total Posts:  4
Joined  2010-12-28

This is for all the lastest software: SafeCracker 1.0.2 on EE 2.1.3 with WYGWAM 2.1.6 and Matrix 2.1.

WYGWAM is doubling up inside a Matrix cell in the first row on the initial page load. Then when I add an additional row to Matrix, 2 rows are created, both with the row number incremented by 1 (so there are 2 rows of row 2 with a single WYGWAM, in addition to row 1 with a double WYGWAM stack). Adding another row would result in 2 rows of row 3, and so on.

Any ideas of what’s going on here, and how to fix?

Profile
 
 
Posted: 06 January 2011 07:39 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Can you show us your full template code AND a screenshot? Thanks smile

Profile
 
 
Posted: 06 January 2011 08:33 PM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  4
Joined  2010-12-28

Sure thing.

I had to break the first screenshot into two images because of the forum’s upload height constraint. There’s 1 WYGWAM field, and 1 Matrix field with a WYGWAM field inside a cell. I’m also including a screenshot of an error shown in Firebug; not sure if it’s related.

Here is the minimal test case template code:

<!DOCTYPE html>
<
html lang="en">
<
head>
    <
meta charset="utf-8" />
    <
link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen" />
    
{exp:jquery:script_tag}
    {exp
:jquery:script_tag ui="datepicker"}
    
<style type="text/css" title="text/css" media="all">
        
fieldset { bordernone;}
    
</style>
    <
title>My Account</title>
</
head>
<
body>
    
{exp:safecracker channel="employees" return="employees/edit/ENTRY_ID" entry_id="{segment_3}"}

        {custom_fields}
            {if required}
{/if}{field_label}<br />
             
{if matrix}
                {display_field}
            {
/if}
            {if wygwam}
                {display_field}
            {
/if}
            {if file}
                {file}
            {
/if}
        {
/custom_fields}        
        
<fieldset>
            <
input type="submit" name="submit" value="Submit" />
        </
fieldset>
    
{/exp:safecracker}
</body>
</
html
Profile
 
 
Posted: 06 January 2011 08:42 PM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I’ll try and duplicate this and get back to you.

Profile
 
 
Posted: 06 January 2011 10:26 PM   [ Ignore ]   [ # 4 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I don’t know if this will make a difference, but the latest Wygwam is 2.1.7 and the latest Matrix is 2.1.2.

Profile
 
 
Posted: 06 January 2011 10:55 PM   [ Ignore ]   [ # 5 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Found the bug. If you open up /system/expressionengine/third_party/safecracker/libraries/safecracker_lib.php on line 624 you will find:

$this->parse_variables['field:'.$field['field_name']] = (array_key_exists($field['field_name']$this->custom_fields)) ? $this->display_field($field['field_name']) : ''

Change that to this:

if (strpos($this->EE->TMPL->tagdataLD.'field:'.$field['field_name'].RD) !== FALSE$this->parse_variables['field:'.$field['field_name']] = (array_key_exists($field['field_name']$this->custom_fields)) ? $this->display_field($field['field_name']) : ''
Profile
 
 
Posted: 07 January 2011 01:39 AM   [ Ignore ]   [ # 6 ]
Wallflower
Rank
Total Posts:  4
Joined  2010-12-28

Thanks Rob, I made that change and it works great with the version I have of WYGWAM and Matrix (and the Firebug error is gone as well). I just installed these a few days ago; how quickly software updates.

Appreciate the fast response and support.

Shawn

Profile