Show or hide on dropdown selection

I have a form on my site, which contains a dropdown with a list of all the countries in the world.

I have managed to add some code that when the United Kingdom shows, the submit button is visible, but any other country and the submit button hides and a small piece of text appears.

I’m now ready to accept the form from different countries, so need to add their value to the code, but what I have tried isn’t working

Here’s the code:

export function countries_change(event) {
 if ($w('#countries').value === 'United Kingdom (UK)') {
        $w('#submit').show();
    $w('#text57').hide();
    } else {
        $w('#submit').hide();
    $w('#text57').show();
    }
}

Basically, I want to be able to add more countries to show the submit button such as New Zealand, Canada, United States etc.

Any help is appreciated

Have an array of country values (for submission)
then:

if(contryValueArray.includes($w('#countries').value)){
//....
}

I’ve just given that a go and it’s better. This time, it doesn’t show any text, but it also doesn’t show the button to submit the form

@noahlovell Check the console for errors

@jonatandor35 Not showing any errors. I’ve tried using different countries. I’ve noticed it will only show the button if the answer is United Kingdom

Wait,

This is what is in the console if I choose a country within the array that isn’t UK. If it’s within the array and isn’t the UK, then the submit button doesn’t show

“root”: {

“insertId”:“…68ucsp7a8CksOJlsl6FIky”
“timestamp”:“2021-10-21T16:15:35.971Z”
“severity”:“INFO”

“labels”: { “siteUrl”:“https://www.noahlovell.design
“namespace”:“Velo”
“tenantId”:“b060e271-1c00-4e58-af15-6034002adb94”
“viewMode”:“Preview”
“revision”:“371”
}

“operation”: { “id”:“…5CN27cCJW2w8IdgZsnI6SL”
“producer”:“/lets-make-it-happen”
“first”:false
“last”:false
}

“sourceLocation”: {}

“jsonPayload”: { “message”:“CC test {“experiments”:{“experiments”:{“specs.challenges.BMEnableServerless”:“true”,“specs.wos.ProgramsCategory”:“true”,“specs.ricos.newSocialAndVerticalEmbedModal”:“false”,“specs.challenges.BMShowOnboardingOnEmptyState”:“true”,“specs.challenges.BMEnableAutopilotADI”:“false”,“specs.challenges.OOIParticipantsCountWarning”:“true”,“specs.challenges.BMOwnerSEORedirect”:“false”,“specs.challenges.EnsureFEEssentialsEnabled”:“false”,“specs.challenges.BMEnableAutopilotEditorX”:“false”,“specs.challenges.OOIEnableAddAddons”:“true”,“specs.challenges.EnsureCentralizedConductionEnabled”:“false”,“specs.challenges.BMFeedbackRightAnswer”:“true”,“specs.challenges.BMEnableSettingsRedesign”:“true”,“specs.ricos.useQualityPreload”:“true”,“specs.challenges.OOIPromptLoginModalUser”:“true”,“specs.challenges.BMSectionDrippingContent”:“true”,“specs.challenges.WebMemberNewSettings”:“true”,“specs.challenges.BMShowOnboardingOnEmptyStateADI”:“true”,“specs.challenges.WebMemberShowStepShare”:“true”,“specs.ricos.pastedFilesSupport”:“true”,“specs.wixRicos.OOIRicosViewerEmptyStateGFPP”:“true”,“specs.ricos.newVideoModal”:“false”,“specs.challenges.WebUseSlugsInURL”:“true”,“specs.challenges.BMEnableAutopilot”:“true”,“specs.challenges.OOIEnableProgramListTitle”:“true”,“specs.challenges.BMContentDripping”:“true”,“specs.challenges.OOIEnableServerlessAPI”:“true”,“specs.challenges.OOIEnableListSideLayout”:“true”,“specs.challenges.BMOwnerEditTemplate”:“false”,“specs.challenges.OOIMyProgramsMA”:“true”,“specs.challenges.BMParticipantViewFirstInPreview”:“false”,“specs.challenges.BMCategoryForTemplates”:“true”,“specs.challenges.BMParticipantsCountWarning”:“true”,“specs.ricos.UseUndoForPlugins”:“true”,“specs.ricos.removeUsmFromImageUrls”:“true”,“specs.challenges.BMEnableOfflinePayment”:“true”,“specs.challenges.BMNotificationSettings”:“true”,“specs.challenges.EditorChangedMocks”:“true”,“specs.challenges.WebMemberEnableAgenda”:“true”,“specs.challenges.BMOwnerAutomations”:“true”,“specs.challenges.OOIStretchProgramImages”:“true”,“specs.challenges.OOIEnableHiddenAndLockSteps”:“true”,“specs.ricos.lazyImagesAndIframes”:“false”,“specs.challenges.WebNewSidebarScrollingBehaviour”:“true”,“specs.challenges.WebOverviewStartButton”:“true”,“specs.challenges.WebMemberDripContent”:“true”,“specs.challenges.EnableProgramsBannerBM”:“true”,“specs.challenges.OOIEnableVisibilityByName”:“false”,“specs.challenges.OOIShareChallenge”:“true”,“specs.ricos.newVerticalEmbedModal”:“false”,“specs.challenges.OOIEnableServerlessAPIChallenge”:“false”,“specs.challenges.BMNewInvitationModal”:“true”,“specs.challenges.BMRicosToolbarTooltip”:“true”,“specs.challenges.OOIOwnerSettingsPanelEmptyState”:“true”,“specs.ricos.anchorScrollWithSmoothScrollIntoViewIfNeeded”:“false”,“specs.ricos.newSocialEmbedModal”:“false”,“specs.challenges.OOIGroupsVisibilitySP”:“true”,“specs.challenges.BMInfoCardRedesign”:“false”,“specs.ricos.anchorScrollWithoutScrollIntoView”:“false”,“specs.wixRicos.useSeo”:“false”,“specs.wixRicos.mobileSettingsOOI”:“true”,“specs.challenges.EnableOnboardingInBM”:“true”,“WebMemberBadgeAllStepsForSPC”:“true”,“specs.challenges.EnableSectionsBM”:“true”,“specs.challenges.EnableSeoSidePanelInBm”:“true”,“specs.challenges.WebEnableRenderSeoTags”:“true”,“specs.challenges.OOIEnableSideAddon”:“true”,“specs.challenges.OOIEmptyChallengesStateInSP”:“true”,“specs.challenges.OOIEnableConcurrentMode”:“true”}}}”
}
“receiveTimestamp”:“2021-10-21T16:15:40Z”
}

@noahlovell Maybe the values in the array are misspelled.

@jonatandor35 I’ve also checked and nope

@jonatandor35 Thanks for the help. Discovered that a condition within the form hadn’t been removed so was interfering with the code.