[eluser]clariz[/eluser]
Thanks Jay Turley for giving new ideas.
I came up to a code which solved the problem.
I also used your code as a reference.
At the end, the code I made was not that good but it solved the problem which is more important (to have an output) :lol:
JS code in a separate file:
Code:
function clickHandlers(e){
stat = 'False';
$("input.inputQuestion").blur(function(){
$("#txtQuestion").attr("value", $(this).attr("value"));
$("#formCheck").ajaxSubmit({success:show_result});
});
}
function show_result(responseText){
var arr = responseText.split('###');
if(arr[0] > 0){
if(stat == 'True'){
return false; //this is to prevent alert function from
//"popping up" twice or more in same question value
//since I have a hard time understanding the code of event delegation in jquery
}
alert("Error: Question already exists.");
stat = 'True';
}
}
Same html code except this line
Code:
Question <input type='text' name='Que[]' id='Que' size='38' />
I changed it to
Code:
Question < input type='text' name='Que[]' id='Que'
onb lur = 'click Handlers()' class='inputQuestion' size='38' >
And also in creating dynamic textfields was changed to
Code:
Question <input name='Que[]' type='text' class='inputQuestion' id='Que'
value='"+ value +"' size='38' onb lur='clickHandlers()'
onC hange = ' [removed] saveQue("+ id +",this.value)' />
I just added a call to a function.
I hope anyone could find this post useful.
Thanks for the persons who read this post especially to Jay Turley for all the replies. ;-)
-clariz-