File tree Expand file tree Collapse file tree 2 files changed +28
-9
lines changed
Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -1441,11 +1441,25 @@ function save_question_list(question_list) {
14411441 var remind_list = $( \'*[name*="remind_list"] \').serialize();
14421442 var hotspot = $( \'*[name*="hotspot[ \'+qid+ \']"] \').serialize();
14431443 var dc = $( \'*[name*="choiceDegreeCertainty[ \'+qid+ \']"] \').serialize();
1444- var dataStr = " ' .$ params .'&type=simple&question_id="+qid
1445- +"&"+my_choice
1446- + (hotspot ? "&"+hotspot : "")
1447- + (remind_list ? "&"+remind_list : "")
1448- + (dc ? "&"+dc : "");
1444+
1445+ var editorContent = getContentFromEditor("choice"+qid);
1446+ var free_choice = "";
1447+ if (editorContent) {
1448+ var obj = {};
1449+ obj["choice["+qid+"]"] = editorContent;
1450+ my_choice = $.param(obj);
1451+ var fo = {};
1452+ fo["free_choice["+qid+"]"] = editorContent;
1453+ free_choice = $.param(fo);
1454+ }
1455+
1456+ var dataStr = " ' .$ params .'&type=simple&question_id="+qid
1457+ +"&"+my_choice
1458+ + (hotspot ? "&"+hotspot : "")
1459+ + (remind_list ? "&"+remind_list : "")
1460+ + (dc ? "&"+dc : "")
1461+ + (free_choice ? "&"+free_choice : "");
1462+
14491463 return $.ajax({
14501464 type: "POST",
14511465 url: " ' .api_get_path (WEB_AJAX_PATH ).'exercise.ajax.php? ' .api_get_cidreq ().'&a=save_exercise_by_now",
Original file line number Diff line number Diff line change 643643 $ my_choice = 'assets: ' . count ($ uploadAnswerAssetIds [$ my_question_id ] ?? []);
644644 }
645645 // Getting free choice data.
646- if (in_array ($ objQuestionTmp ->type , [FREE_ANSWER , ORAL_EXPRESSION ]) && 'all ' == $ type ) {
647- $ my_choice = isset ($ _REQUEST ['free_choice ' ][$ my_question_id ]) && !empty ($ _REQUEST ['free_choice ' ][$ my_question_id ])
648- ? $ _REQUEST ['free_choice ' ][$ my_question_id ]
649- : null ;
646+ if (in_array ($ objQuestionTmp ->type , [FREE_ANSWER , ORAL_EXPRESSION ])) {
647+ if ('all ' === $ type ) {
648+ $ my_choice = $ _REQUEST ['free_choice ' ][$ my_question_id ] ?? $ my_choice ;
649+ } elseif ('simple ' === $ type && isset ($ _REQUEST ['free_choice ' ][$ my_question_id ]) && $ _REQUEST ['free_choice ' ][$ my_question_id ] !== '' ) {
650+ $ my_choice = $ _REQUEST ['free_choice ' ][$ my_question_id ];
651+ }
652+ if (is_string ($ my_choice )) {
653+ $ my_choice = trim ($ my_choice );
654+ }
650655 }
651656
652657 if ('all ' === $ type ) {
You can’t perform that action at this time.
0 commit comments