Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix form custom fields #13248

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions static/js/src/landscape-saas-form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function stringifyCustomFields() {
const checkboxes = document.querySelectorAll(".js-checkbox");
const textarea = document.getElementById("Comments_from_lead__c");
textarea.value = "";
let ubuntuProLocations = "";

checkboxes.forEach(function (checkbox) {
if (checkbox.children[0].checked) {
const text = checkbox.children[1].innerHTML;
ubuntuProLocations += " \r\n" + text;
}
});

if (ubuntuProLocations) {
textarea.value +=
" \r\n" + "I have Ubuntu Pro on:" + ubuntuProLocations + " \r\n";
}
}
2 changes: 1 addition & 1 deletion templates/landscape/pricing.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ <h2>Speak to a member of our team</h2>
<div class="u-hide" id="contact-form-container" data-form-location="/shared/forms/interactive/landscape" data-form-id="4473" data-lp-id="" data-return-url="/landscape/pricing" data-lp-url="https://pages.ubuntu.com/things-contact-us.html">
</div>

<script src="/static/js/src/landscape-form.js"></script>
<script src="/static/js/src/landscape-saas-form.js"></script>


{% endblock content %}
14 changes: 7 additions & 7 deletions templates/shared/forms/interactive/landscape-pricing-saas.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2 class="p-modal__title u-sv1" id="modal-title">Submit this form to get Landsc
<h3 class="p-heading--5">Submit your information to get a free account</h3>
<div class="row u-no-padding">
<div class="col-6">
<form action="/marketo/submit" onsubmit="contactPreference()" method="post" id="mktoForm_%% formid %%" class="modal-form" id="landscape-form">
<form action="/marketo/submit" onsubmit="stringifyCustomFields()" method="post" id="mktoForm_%% formid %%" class="modal-form" id="landscape-form">
<ul class="p-list">
<li class="p-list__item">
<label for="firstName">First name:</label>
Expand All @@ -29,27 +29,27 @@ <h3 class="p-heading--5">Submit your information to get a free account</h3>
</li>
<div class="p-list__item u-sv2">
<label>I have Ubuntu Pro on:</label>
<label class="p-checkbox">
<label class="p-checkbox js-checkbox">
<input type="checkbox" aria-labelledby="ubuntu-pro-on-aws" class="p-checkbox__input">
<span class="p-checkbox__label" id="ubuntu-pro-on-aws">AWS</span>
</label>
<label class="p-checkbox">
<label class="p-checkbox js-checkbox">
<input type="checkbox" aria-labelledby="ubuntu-pro-on-azure" class="p-checkbox__input">
<span class="p-checkbox__label" id="ubuntu-pro-on-azure">Azure</span>
</label>
<label class="p-checkbox">
<label class="p-checkbox js-checkbox">
<input type="checkbox" aria-labelledby="ubuntu-pro-on-gcp" class="p-checkbox__input">
<span class="p-checkbox__label" id="ubuntu-pro-on-gcp">GCP</span>
</label>
<label class="p-checkbox">
<label class="p-checkbox js-checkbox">
<input type="checkbox" aria-labelledby="ubuntu-pro-on-physical" class="p-checkbox__input">
<span class="p-checkbox__label" id="ubuntu-pro-on-physical">Physical Servers with unlimited VMs</span>
</label>
<label class="p-checkbox">
<label class="p-checkbox js-checkbox">
<input type="checkbox" aria-labelledby="ubuntu-pro-on-desktops" class="p-checkbox__input">
<span class="p-checkbox__label" id="ubuntu-pro-on-desktops">Desktops</span>
</label>
<label class="p-checkbox">
<label class="p-checkbox js-checkbox">
<input type="checkbox" aria-labelledby="ubuntu-pro-on-iot" class="p-checkbox__input">
<span class="p-checkbox__label" id="ubuntu-pro-on-iot">IoT and devices</span>
</label>
Expand Down