Expand my Community achievements bar.

Webpage validation required in adobe from web form to the data in the schema

Avatar

Level 3

Hi Team,

 

We are trying to assign zipcode validation for web application in adobe campaign classic.

 

Requirement :

User should enter only the zipcode which are in zipcode schema, then only form should get submitted otherwise it should provide an alert with please enter valid zipcode.

 

In javascript of the HTML page we are using this zipcode to get all the zipcodes from the schema and store it in the array.

 

Below is the code

 

var allpincodes2 = [<% for each(var rec in new XML(xtk.queryDef.create(<queryDef schema="schemaname" operation="select" lineCount="50000"> <select> <node expr="@ZIPCODE" alias="ZIPCODE"/> </select>  </queryDef>).ExecuteQuery().toXMLString())){ %>
"<%= rec.toString().replace("<S_ZIPCODE><ZIPCODE>","").replace("</ZIPCODE></S_ZIPCODE>","") %>", <% } %> ];

 

 

$(document).ready(function () {

$(".pincode").change(function ()
{
var value = document.getElementById("pincode").value;


const filtered = allpincodes2.filter(word => word === value);
if(filtered.length == 0){
alert("Please select a zipcode from the provided zipcode list");
document.getElementById('pincode').value=null;
}
console.log(filtered);
});
});
// ]]></script>

 

Issue with the web page:

Loading time is around 15 seconds for the webpage, since it tries to assign all 47000 records from the schema to the array.

Hard coded values to the array takes around 7 to 8 seconds.

 

Required solution

Is there any other approach to bring the webpage loading time to 1 to 2 seconds?

Or

Can any one suggest different approaches to the validation of the zipcodes in text box?

 

Thanks,

Sachin C S

 

 

 

4 Replies

Avatar

Community Advisor

Hello Sachin,

 

You can create a jssp pages in dynamic jssp pages where in you can accept the query string for the zip code and then according to that query string you can  search for the zip code in the the adobe schema.

 

From your landing page, As soon as a customer enter the zipcode you can send an Ajax request to the jssp page and get the response and display on the landing page.

 

Thanks,

Manoj

 


     Manoj
     Find me on LinkedIn

Avatar

Level 3

Hi @_Manoj_Kumar_ ,

 

Do we have any OOTB structure validation for the same.

Or any documentation for referral on the same.

 

Thanks,

Sachin C S

Avatar

Community Advisor

Hi Sachin,

 

You could try below two options:

1) In case you want to display values of zipcode in dropdown, you could simply create a dropdown and map the value with zipcode column, it will automatically pickup. Or you could define dropdown values.

2) Or, have simple validation test whether zipcode is empty and zipcode value is equal to 6 ( In case of India). For data validation, you could design a technical workflow which will delete( or necessary action) data.

 

Thanks,

Jyoti 

Avatar

Level 3

Hi @Jyoti_Yadav ,

 

Requirement is to do validation for exactly 47,000 records in the schema.

It is for USA zipcodes.

 

Thanks,

Sachin C S