Skip to main content

Hi guys, 

 

I'm working on my form Layout and I recently added a javascript to show the phone country code on my phone field on forms. 

 

The problem is that even if the phone number is a required field, the phone code value (ex for France +33) is enough to bypass the field completion. 

 

I'd like to add a min and max caracter number to avoid this. Is it possible through css? 

 

I don't have access to the main script (which is here: https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.15/js/utils.min.js) and I don't want to mess with it by adding another script in my layout. 

 

Best, 

 

Hugo

 

#Data Management #Sales Cloud #Salesforce Developer #Developers

2 respostas
  1. 16 de nov. de 2023, 07:56

    Hi @Michael Brown, thanks for the answer, the only HTML part I have access to is on the "Form" tab of the layout. It goes like this:

     

    <form accept-charset="UTF-8" method="post" action="%%form-action-url%%" class="form" id="pardot-form">

    %%form-opening-general-content%%

    %%form-if-thank-you%%

    %%form-javascript-focus%%

    %%form-thank-you-content%%

    %%form-thank-you-code%%

    %%form-end-if-thank-you%%

    %%form-if-display-form%%

    %%form-before-form-content%%

    %%form-if-error%%

    <p class="errors">Please correct the errors below:</p>

    %%form-end-if-error%%

    %%form-start-loop-fields%%

    <div class="form-field %%form-field-css-classes%% %%form-field-class-type%% %%form-field-class-required%% %%form-field-class-hidden%% %%form-field-class-no-label%% %%form-field-class-error%% %%form-field-dependency-css%%">

    %%form-if-field-label%%

    <label class="field-label" for="%%form-field-id%%">%%form-field-label%%</label>

    %%form-end-if-field-label%%

    %%form-field-input%%

    %%form-if-field-description%%

    <span class="description">%%form-field-description%%</span>

    %%form-end-if-field-description%%

    <div id="error_for_%%form-field-id%%" style="display:none"></div>

    %%form-field-if-error%%

    <p class="error no-label">%%form-field-error-message%%</p>

    %%form-field-end-if-error%%

        </div>

    %%form-end-loop-fields%%

    %%form-spam-trap-field%%

    <!-- forces IE5-8 to correctly submit UTF8 content  -->

    <input name="_utf8" type="hidden" value="☃" />

    <div class="submit">

    <input type="submit" accesskey="s" value="%%form-submit-button-text%%" %%form-submit-disabled%%/>

    </div>

    %%form-after-form-content%%

    %%form-end-if-display-form%%

    %%form-javascript-link-target-top%%

    </form>

     

    Unfortunately, the code you gave me does not match the info I get when I inspect my form (screen attached) - especially the name and ID that change depending on the form. Any idea how to solves this? 

0/9000