Form: I cannot Inject CSS code in my form

  • mslupek
    Asked on 12 września 2023 06:38

    powybraniu przycisku "wałka" i znalezieniu opcji css wpisałem tam następujący kod ktory powinien sprawdzać czy wpisana w pole tekst zgodny jest z którymś z predefiniowanych tekstów
    Po naciśnięciu "Zapisz" mój kod css znika

    KOD:

    <script>

    // Lista możliwych tekstów

    var listaMozliwychTekstow = ["tekst1", "tekst2", "tekst3"];

    var poleTekstoweId = "#input_4"; // ID mojego pola tekstowego


    // Funkcja sprawdzająca wpisany tekst

    function sprawdzTekst() {

      var wpisanyTekst = document.getElementById(poleTekstoweId).value;

      if (listaMozliwychTekstow.includes(wpisanyTekst)) {

        alert("Wpisany tekst jest na liście możliwych tekstów.");

      } else {

        alert("Wpisany tekst nie jest na liście możliwych tekstów.");

      }

    }

    document.getElementById(poleTekstoweId).addEventListener("input", sprawdzTekst);

    </script>



    Dlaczego? Jak temu zapobiec?

    Z góry dziekuję
    Voytek Kucharski

  • Camila Jotform Support
    Replied on 12 września 2023 11:45

    Hi mslupek,

    Thanks for reaching out to Jotform Support. Unfortunately, our German Support agents are busy helping other Jotform users at the moment. I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in German, let us know and we can have them do that. But, keep in mind that you'd have to wait until they're available again.

    Now, let me help you with your question. As I understand, you want to add a CSS code to your form. I checked it on my end, and I was able to inject a CSS code. Please see my screencast below:

    Form: I cannot Inject CSS code in my form  Image 1 Screenshot 20
    Can you please try again and let us know if you need any more help? If you still get the issue, please send us the Form URL, so we can test it on our end. You can check out this guide about Where to Find Your Form URL.

    Reach out again if you need any more help.

  • mslupek
    Replied on 13 września 2023 05:25

    Please provide instructions on how to change the "Short text:" field to accept only previously determined values. The user cannot see the list of possible values.

    Can I add JavaScript code to this field?

    My form is:
    https://form.jotform.com/232542280247351

  • Jovanne Jotform Support
    Replied on 13 września 2023 19:13

    Hi mslupek,

    Unfortunately, it is not possible to insert custom JavaScript codes into the Form Builder for security purposes. The only way to insert custom JS codes into the form is by downloading the form source code. This way, you can freely modify the form source code and insert your own.

    But please note that modification and customization of form source code are beyond our support scope. This workaround is quite tricky, so I suggest you look for a web developer who can help you with your requirements.

    If there are specific features you're looking for, we can submit that as a feature request, but note that requests have priorities depending on the number of users requesting them.

    Let us know if you have any other questions.