Welcome Guest, Not a member yet? Register   Sign In
using jquery on checking duplicate data in database with dynamic textfields
#9

[eluser]clariz[/eluser]
Thanks Vitek.
I have tried your code but the same thing happened, the problem still there.
But thanks for that code, that helps.Really gave me new ideas.

I came up to a code which solved the problem.
I also used Vitek's code as a reference, and also GSV Sleeper Service's idea.
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' on blur = ' clickHandlers ( ) ' 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' on blur= 'clickHandlers()' on Change ='[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 Vitek, and GSV Sleeper Service for all the replies. Really appreciate you guys. ;-)


-clariz-


Messages In This Thread
using jquery on checking duplicate data in database with dynamic textfields - by El Forum - 09-23-2008, 06:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB