Home › Forums › Quform WordPress › Using JavaScript to pull information
- This topic has 5 replies, 2 voices, and was last updated 10 months, 3 weeks ago by GOMLP.
- AuthorPosts
- January 22, 2024 at 1:25 am #36436GOMLPParticipant
Hi Ally,
I hope this message finds you well and Happy New Year.
Once again I’m seeking your assistance.
I’m trying to create an event register form. Each client will be mailed a personalized invite with a unique registration code.
When they go to register online the form will ask for them to enter their unique code to proceed to the Entry Form.
I want this unique code to look up a JQuery and populate an HTML text element with information on the next page.
Registration Code = Company Name
A6HH8375GT = Acme Co. Ltd.
BG6DE527HT = Jon’s Smoking Hot SauceIs it possible you could shed some insight on how to do this using Custom JavaScript once again for me please.
January 22, 2024 at 10:59 am #36438AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 1, 2024 at 2:31 am #36455GOMLPParticipantHi Ally,
Sorry for the delay in responding. The code worked good, however I’ve been trying to play around with it a bit more to extend the functionality and I’m not having much luck.
My goal is to allow the customer to enter their unique invitation code on the first page and when proceeding to the second page of the form it will look up the customer’s information based on this unique invitation code so I can use this looked up information in a custom HTML header text for display, while also pre populating form fields to confirm that their phone number, email and mailing addresses information is correct. If their information needs to be updated the customer can either click on a check box to either enable editing of the information field(s) or simply overwrite the looked up information for submission.
But in either case I want to be able to look up this information for; 1) Customizing an HTML welcome header on the second page and 2) populating form fields with the looked up information.
jQuery(function ($) {
var contactInfo = {
’11’: {
firstName: ‘Todd’,
lastName: ‘Rose’,
eMailAddress: ‘toddl@gomlp.net’,
phoneNumber: ‘(902) 835-2400’,
companyName: ‘Maritime Labels & Packaging’,
mailingStreetAddress: ‘9172 Highway 14’,
mailingCity: ‘Milford’,
mailingProvince: ‘Nova Scotia’,
mailingPostalCode: ‘B0N 1Y0’,
shippingAddress: ‘9172 Highway 14’,
shippingCity: ‘Milford’,
shippingProvince: ‘Nova Scotia’,
shippingPostalCode: ‘B0N 1Y0′
},
’22’: {
firstName: ‘Paul’,
lastName: ‘Sproule’,
eMailAddress: ‘paul@gomlp.net’,
phoneNumber: ‘(902) 835-2400’,
companyName: ‘Maritime Labels & Packaging’,
mailingStreetAddress: ‘9172 Highway 14’,
mailingCity: ‘Milford’,
mailingProvince: ‘Nova Scotia’,
mailingPostalCode: ‘B0N 1Y0’,
shippingAddress: ‘9172 Highway 14’,
shippingCity: ‘Milford’,
shippingProvince: ‘Nova Scotia’,
shippingPostalCode: ‘B0N 1Y0′
},
’33’: {
firstName: ‘Kyle’,
lastName: ‘Tomblin’,
eMailAddress: ‘kyle@gomlp.net’,
phoneNumber: ‘(902) 835-2400’,
companyName: ‘Maritime Labels & Packaging’,
mailingStreetAddress: ‘9172 Highway 14’,
mailingCity: ‘Milford’,
mailingProvince: ‘Nova Scotia’,
mailingPostalCode: ‘B0N 1Y0’,
shippingAddress: ‘9172 Highway 14’,
shippingCity: ‘Milford’,
shippingProvince: ‘Nova Scotia’,
shippingPostalCode: ‘B0N 1Y0’
},
};$(‘.quform-field-12_7’).on(‘change’, function () {
var value = $(this).val();if (value && contactInfo[value]) {
var contact = contactInfo[value];$(‘.quform-element-12_38 .quform-spacer’).html(contact.firstName);
$(‘.quform-element-12_36 .quform-spacer’).html(substrate.lastName);
$(‘.quform-element-14_1065 .quform-spacer’).html(substrate.adhesive);
$(‘.quform-element-14_1069 .quform-spacer’).html(substrate.min_app_temp);
$(‘.quform-element-14_1075 .quform-spacer’).html(substrate.service_temp_range);
}
});
});February 1, 2024 at 10:13 am #36458AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 1, 2024 at 10:53 pm #36461GOMLPParticipantHi Ally,
I fixed the code discrepancies and apologize for that. I now have the code corrected, however I still can’t seem to pull in that information from within the custom JS to display a custom message at the top with the client’s name.
And for the likes of me I can’t seem to figure out how to pull the JS code to auto-fill fields.
I’ve send you a message with the URL link and username and password for you to have a look at.
Thanking you in advance,
Todd RFebruary 3, 2024 at 2:48 am #36462GOMLPParticipantHi Ally,
Once again I thank you! Your assistance on this was greatly helpful and taught me something new.
- AuthorPosts
- You must be logged in to reply to this topic.