General developer forum

Moodle 3.4 content saving issue

 
Picture of Sajjad Haider
Moodle 3.4 content saving issue
 

Hello


First of all i have to mention that i,m not a professional coder, so i don't know if this is the right place to ask this question.


I,m using Moodle 3.4.1+ (Build: 20180125) with Adaptable 1.7.1 (2018073000) Theme, and i,m facing problems with saving activities content with Atto HTML editor (2017111300).


Actually i,m trying to create Buttons with Bootstrap collapse Functionality  in my Lesson Activity. It works fine in Editing Mode, but when i save the content and view it on course page it is not working and when i inspect it with my browser DevTools its code was automatically changed.

Surprisingly when i return back to Editing Mode the code was there and fully functional there as i saved it.


My Sample Code:

<div class="text-center">
<button data-toggle="collapse" data-target="#A" type="button" class="btn bg-warning collapsed" atto_collapse_button="" highlight="" collapsed"="" tabindex="0" title="Show More Details" style="height:80px;Width:200px;"><span style="font-size:50px; ">A</span></button>
<button data-toggle="collapse" data-target="#B" type="button" class="btn btn-info atto_collapse_button highlight collapsed" tabindex="0" title="Show More Details" style="height:80px;Width:200px;"><span style="font-size:50px;">B</span></button>
<button data-toggle="collapse" data-target="#C" type="button" class="btn btn-success atto_collapse_button highlight collapsed" tabindex="0" title="Show More Details" style="height:80px;Width:200px;"><span style="font-size:50px;">C</span></button>
<button data-toggle="collapse" data-target="#D" type="button" class="btn btn-danger atto_collapse_button highlight collapsed" tabindex="0" title="Show More Details" style="height:80px;Width:200px;"><span style="font-size:50px;">D </span></button>
<div id="D" class="collapse" style="height: 0px;">
<p>Sample Text D</p>
</div>
<div id="C" class="collapse" style="height: 0px;">
<p>Sample Text C</p>
</div>
<div id="B" class="collapse" style="height: 0px;">
<p>Sample Text B</p>
</div>
<div id="A" class="collapse" style="height: 0px;">
<p>Sample Text A</p>
</div>
</div>


this code will be changed after saving it into:


<div class="text-center" id="yui_3_17_2_1_1536558598550_221">
  <button type="button" class="btn bg-warning collapsed" tabindex="0" title="Show More Details" style="height:80px;Width:200px;" id="yui_3_17_2_1_1536558598550_220"><span style="font-size:50px;" id="yui_3_17_2_1_1536558598550_219">A</span></button> <button type="button" class="btn btn-info atto_collapse_button highlight collapsed" tabindex="0" title="Show More Details" style="height:80px;Width:200px;"><span style="font-size:50px;">B</span></button> <button type="button" class="btn btn-success atto_collapse_button highlight collapsed" tabindex="0" title="Show More Details" style="height:80px;Width:200px;"><span style="font-size:50px;">C</span></button> <button type="button" class="btn btn-danger atto_collapse_button highlight collapsed" tabindex="0" title="Show More Details" style="height:80px;Width:200px;"><span style="font-size:50px;">D</span></button>
  <div id="D" class="collapse" style="height: 0px;">
    <p>
      Sample Text D
    </p>
  </div>
  <div id="C" class="collapse" style="height: 0px;">
    <p>
      Sample Text C
    </p>
  </div>
  <div id="B" class="collapse" style="height: 0px;">
    <p>
      Sample Text B
    </p>
  </div>
  <div id="A" class="collapse" style="height: 0px;">
    <p>
      Sample Text A
    </p>
  </div>
</div>


This also happens when i try to create some tabs or audio buttons.


please help me if you know any solution of this issue.

I'll be very thankful. 


Haider


 
Average of ratings: -
Picture of Helen Foster
Re: Moodle 3.4 content saving issue - code stripped out when using Atto
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersTestersTranslators

Hi Sajjad,

It often happens that code is stripped out when saving content added using a text editor. Please try disabling the Atto text editor by going to your user preferences and setting the text editor to 'Plain text area'.

 
Average of ratings: -
John Provasnik at Moodle Moot US
Re: Moodle 3.4 content saving issue
Particularly helpful Moodlers

I'm having the SAME issue on Moodle 3.4 with Atto!

I can't change my Text editor because other teachers edit the location where my code is located and so Atto screws it up anyway as soon as they click on the Edit button. This id="yui_3_17_2_1_1536558598550_221" nonsense is driving me batty because I dont know what to do to prevent it. 


I've created a Tracker for this in hopes others can share their story so we can get to the bottom of this. I like Atto and want to make sure it's reliable!

https://tracker.moodle.org/browse/MDL-63365

 
Average of ratings: -
Picture of Justin Hunt
Re: Moodle 3.4 content saving issue
Particularly helpful MoodlersPlugin developers

Can I suggest you use Generico (or Poodll ) for this? 

You put your code in the Generico template.

You add a Generico tag to the html editor

When the Generico filter encounters the tag it will swap it out, for your code.
 

Some widget templates included in Generico / Poodll are here:

https://moodle.org/plugins/browse.php?list=category&id=69



 

 
Average of ratings: Useful (1)