HTML code in HTML question type altered after closing



  • With reference to this thread, I constructed a more complicated example of chaining. It worked in preview mode, but when I closed and reopened the question, the code was heavily altered and the question didn't work in the correct way anymore.

    For the sake of simplicity, I will refer to the code of the aforementioned thread (which is quite shorter), remembering that it reads as:

    <div>
    <form method="GET" action="" onSubmit="" style="margin:0; padding:0; width:500px;">
        <p>
        \( y(x) = $a x^3 + $b x^2 \)
       
        Calculate \( \dfrac{dy}{dx} \)
       </p>
       <p>
       \( \dfrac{dy}{dx} =\)
        <input type="text" name="BoxA" id="BoxA" style="width:100px; display:inline;"/>
       </p>
       
       <p>
        Evaluate \( \dfrac{dy}{dx} \) at \( x = $c \)
        </p>
       <p>
        \( y'($c) =\)
        <input type="text" name="BoxB" id="BoxB" style="width:100px; display:inline;"/>
        </p>
        
    </form>
    </div>

    If I insert it into a question, I save it, I close, and I reopen, the code modifies itself into:

    <div>  
     <p> \( y(x) = $a x^3 + $b x^2 \) Calculate \( \dfrac{dy}{dx} \) </p>
     <p> \( \dfrac{dy}{dx} =\)  </p>
     <p> Evaluate \( \dfrac{dy}{dx} \) at \( x = $c \) </p>
     <p> \( y'($c) =\)  </p>  
    </div>
    which of course does not allow interaction. Note how the tags form and input are gone.

    There are also minor modifications on the JavaScript, on the grading code, and on the algorithm if present, but they only consist in moving all the code in a single line (which is annoying especially if you have comments, but it is possible to deal with it).

    Why does the system modify the code in that fashion? And, most of all, is there a way to prevent it from doing modifications?

    Thanks in advance.


  • administrators

    Not sure why the code is modified but I know it is sort of minified when it is deployed which is why multi-line comments and semi-colons are required.

    With reference to the code in this post, I have just tried to make a question with just this in the Question HTML of the HTML question type, saved it and then reopened and it seems fine. Can you send some screenshots or a screencast of this problem happening. It is not one I have seen before?



  • Thank you. I attach a screencast of the problem; it is depicted how preview works fine, but reopening does not.


  • administrators

    This is very strange. Can you send the text from the three sections of the html question? If you don't want to post it, you can email is to me.



  • Ok, where can I find your mail? Just because they are exercises that can be given to students in the future as part of an exam.


  • administrators

    This post is deleted!


  • Thank you, I just sent you the texts.


Log in to reply