Check my code.It is working fine in page but when i am using same page in popup with page include at that time below code is not working.
Agcontact.setCondition(FirstNamecondition,Firstname,true);
skuid.model.updateData((Agcontact]);
Agcontact.load();
Please help me as soon as possible.
-----------------
var params = argumentsm0],
step = params.step,
stepEditor = step.editor,
$ = skuid.$;
stepEditor.clearMessages();
var contactModel=skuid.model.getModel(“AddContact”);
var raw=contactModel.getFirstRow();
var Firstname=raw.FirstName;
var Middlename=raw.MiddleName;
var LastName=raw.LastName;
var Birthdate=raw.Birthdate;
var Name=‘’;
if(Firstname!==undefined)
{
Name+=Firstname;
}
if(Middlename!==undefined)
{
Name+=’ ‘+Middlename;
}
if(LastName!==undefined)
{
Name+=’ ‘+LastName;
}
var models = (
skuid.model.getModel(“Candidate”),
skuid.model.getModel(“AddContact”)
];
if(Firstname===undefined || LastName===undefined){
alert(‘Please Enter First Name, Last Name’);
return false;
}
var Agcontact=skuid.model.getModel(“Agcontact”);
if(Firstname!==undefined){
var FirstNamecondition = Agcontact.getConditionByName(‘FirstName’);
Agcontact.setCondition(FirstNamecondition,Firstname,true);
}
if(Middlename!==undefined){
var Middlenamecondition = Agcontact.getConditionByName(‘MiddleName’);
Agcontact.setCondition(Middlenamecondition,Middlename,true);
}
if(LastName!==undefined){
var LastNamecondition = Agcontact.getConditionByName(‘LastName’);
Agcontact.setCondition(LastNamecondition,LastName,true);
}
if(Birthdate!==undefined){
var bd=new Date(Birthdate);
var ageDifMs = Date.now() - bd.getTime();
var ageDate = new Date(ageDifMs); // miliseconds from epoch
var age=Math.abs(ageDate.getUTCFullYear() - 1970);
if(age<18){
alert(“Candidate’s age is less than 18”);
}
var Birthdatecondition = Agcontact.getConditionByName(‘Birthdate’);
Agcontact.setCondition(Birthdatecondition,Birthdate,true);
}
skuid.model.updateData(sAgcontact]);
Agcontact.load();
// If we have warning messages, do NOT proceed
try{
var FirstName=Agcontact.getFirstRow().FirstName;
alert(FirstName);
if(FirstName!==undefined)
{
var messages = ;
var msg = ;
msg.message=Name+’ is already registor.Do you want to continue?..Click me’;
msg.severity=‘WARNING’;
messages.push(msg);
if (messages.length) {
var r = confirm(Name+’ is already registor’);
if (r === true) {
return true;
} else {
stepEditor.handleMessages(messages);
return false;
}
// Have our step’s editor handle the messages
}
}
}catch(e){
}
Is the AgContact model repeated in the include and its parent? That will certainly cause problems.
I have check all the models.All models have different name.
I am using AgContact model only in child.
I have update code like below and my models also not conflict.
Now I am changing my question
I have added 4 condition to my model.
I need populate data based on that condition.I had created that condition for duplicate check.I need add duplicate check function with the help of birthdate and full name of candidate.So I have created below code.When I have debug at that time I found that When I am applying this condition my model not fetch data based on my condition it just populated data which I have last entered and saved in this model.
So I need help from Skuid team for correction in my code.I am adding my full code in detail.Please check my code and provide me some suggestion so I can complete my code.
---------------------------------
var params = argumentse0],
step = params.step,
stepEditor = step.editor,
$ = skuid.$;
stepEditor.clearMessages();
var contactModel=skuid.model.getModel(“AddContact”);
var raw=contactModel.getFirstRow();
var Firstname=raw.FirstName;
var Middlename=raw.MiddleName;
var LastName=raw.LastName;
var Birthdate=raw.Birthdate;
var Name=‘’;
if(Firstname!==undefined)
{
Name+=Firstname;
}
if(Middlename!==undefined)
{
Name+=’ ‘+Middlename;
}
if(LastName!==undefined)
{
Name+=’ ‘+LastName;
}
if(Firstname===undefined || LastName===undefined){
alert(‘Please Enter First Name, Last Name’);
return false;
}
var Agcontact=skuid.model.getModel(“Agcontact”);
if(Firstname!==undefined){
var FirstNamecondition = Agcontact.getConditionByName(‘FirstName’);
Agcontact.setCondition(FirstNamecondition,Firstname,true);
}
if(Middlename!==undefined){
var Middlenamecondition = Agcontact.getConditionByName(‘MiddleName’);
Agcontact.setCondition(Middlenamecondition,Middlename,true);
}
if(LastName!==undefined){
var LastNamecondition = Agcontact.getConditionByName(‘LastName’);
Agcontact.setCondition(LastNamecondition,LastName,true);
}
if(Birthdate!==undefined){
var bd=new Date(Birthdate);
var ageDifMs = Date.now() - bd.getTime();
var ageDate = new Date(ageDifMs); // miliseconds from epoch
var age=Math.abs(ageDate.getUTCFullYear() - 1970);
if(age<18){
alert(“Candidate’s age is less than 18”);
}
var Birthdatecondition = Agcontact.getConditionByName(‘Birthdate’);
Agcontact.setCondition(Birthdatecondition,Birthdate,true);
}
skuid.model.updateData(8Agcontact]);
Agcontact.load();
try{
var FirstNameContact=Agcontact.getFirstRow().FirstName;
if(FirstNameContact!==undefined)
{
var messages = ;
var msg = ;
msg.message=Name+’ is already registor.Do you want to continue?..Click me’;
msg.severity=‘WARNING’;
messages.push(msg);
if (messages.length) {
var r = confirm(Name+’ is already registor’);
if (r === true) {
return true;
} else {
stepEditor.handleMessages(messages);
return false;
}
}
}
}catch(e){
}
Can you provide me one example with the help of which i can fetch data from model based on my custom condition in java script.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.