how to check duplicate value

Mehr
2 Jahre 10 Monate her #111993 von carrot21
carrot21 erstellte das Thema how to check duplicate value
Hello!
i'm new limesurvyer. i think this program is fantastic...
nowadays i made new survey and had a question.

that is check duplicate text data
i mean when i enter the text value and click the next button, entering value is duplicated or not shows new popup window.
if that value is duplicated, entering value is deleted and do not show next question. if that value is unique, show next question.

i made check program php and javascript and duplicate checking part is no problem.
but the problem is moving part.
when "duplicate value" message show in new popup window, i don't wanna progress any more..
not duplicated value enterd the text box, shows next question.

could you help me?

i apologize my bad english and thank you in advance.


<script type="text/javascript" char="utf-8">

$(document).ready(function() {
$('#movenextbtn, #movesubmitbtn').click(function() {
var cktel=document.getElementById("answer495692X8X14").value;
if (cktel != "")
{
window.open("http://localhost/survey/check/tel_check.php?fieldnames="+cktel,"hiddenframe","toolbar=yes,width=400,height=200");
}
});
});

</script>


tel_check.php

<?php

$mysql= new mysqli('localhost','root','','survey');

if (mysqli->connect_errno)
{
echo "connect fail:(".$mysqli->connect_errno.")".$mysqli->connect_error;
}


$fieldnames=$_GET;
$sql = "SELECT 495692X8X14 FROM survey_495692 where 495692X8X14='$fieldnames'";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_row($result);


if ($row) {
echo ("$fieldnames is duplicated value <br><br>
<input type = 'button' value = 'delete' onclick=\"opner.document.limesurvey.495692X8X14.value='';opner.document.limesurvey.495692X8X14.focus();window.close();\">");
}

else {
echo ("$fieldnames is not duplicated value <br><br>
<input type= 'button' value = 'ok' onclick='window.close();'>");

}

mysqli_close($conn);

?>

Bitte Anmelden um der Konversation beizutretten.

Mehr
2 Jahre 10 Monate her #112004 von tpartner
tpartner antwortete auf das Thema: how to check duplicate value
I would use an AJAX call in a $(#limesurvey).submit() function. If the test fails you can return false to abort the submit.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Bitte Anmelden um der Konversation beizutretten.

Haben Sie schon bei unserer Kundenumfrage mitgemacht?

Verpassen Sie nicht Ihre Chance auf tolle Preise.

Klicken sie hier um teilzunehmen:

Jetzt starten

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten