function
validateQuestionForm(){
var
flag=
true
;
var
err=
false
;
var
err_print =
"Error :<br>"
;
if
($(
'#title'
).val()==
""
) {
err =
true
;
err_print +=
"- Please insert question title.<br>"
;
$(
'#title'
).css({
"border"
:
"1px solid red"
,
"background"
:
"#FFCECE"
});
}
else
{
$(
'#title'
).css({
"border"
:
""
,
"background"
:
""
});
}
if
($(
'input:radio[id^="correct_radio_"]'
).is(
":checked"
) || $(
'input:checkbox[id^="correct_radio_"]'
).is(
":checked"
)) {
}
else
{
err =
true
;
err_print +=
"- Please select correct option.<br>"
;
}
$(
'input[class="correct_txt"]'
).each(
function
() {
if
($.trim($(
this
).val()) ==
''
) {
err =
true
;
if
(flag==
true
) {
err_print +=
"- Please insert question answer.<br>"
;
flag=
false
;
}
$(
this
).css({
"border"
:
"1px solid red"
,
"background"
:
"#FFCECE"
});
}
else
{
$(
this
).css({
"border"
:
""
,
"background"
:
""
});
}
});
if
(err==
true
) {
$(
'#error_notification'
).removeClass(
'displaynone'
).html(err_print);
return
false
;
}
else
{
return
true
;
}
}
function
changeAnswerType(current_type,change_type,answer_type){
$(
'#typechange'
).find(
'input:'
+current_type).attr(
'type'
,change_type,
'checked'
,
''
);
if
(answer_type==
'single'
) {
$(
'#addmore'
).attr(
'onclick'
,
'htmlChange("single","second")'
);
}
else
{
$(
'#addmore'
).attr(
'onclick'
,
'htmlChange("multiple","second")'
);
}
}
No comments:
Post a Comment