Can I let users add a URL , if so is there away to make sure it only comes froma particualr domain?

  • reddittikihut
    Asked on December 20, 2020 at 2:01 AM

    Hello,

    Is there a way I can let users enter a URL into the form? However I want to make sure that they only used URLS from a certain domain. For example, they can only add YouTube domain videos and nothinig else. Is that possible?

    Thank you in advance.

  • Patrick_R
    Replied on December 20, 2020 at 4:36 AM

    Hi! Yes it is possible. You can use the SHOW/HIDE condition to detect the YouTube URL in the provided link and accordingly SHOW the Submit button (screenshot attached below).

    1608456998 5fdf1b26cd98f chrome capture Screenshot 10

    Please check this demo form: https://form.jotform.com/203542366143046

    It will only allow YouTube URLs. If a different URL is provided, then the Submit button won't show up. Feel free to test this form or clone it under your account.

    This is the screencast of the preparation of this demo form: https://drive.google.com/file/d/1bE0tojKg7vyCk1ekpaeLS9l1OlF422hk/view?usp=sharing

    I hope this helps. If you have any questions, let us know.

    Thank you!

  • reddittikihut
    Replied on December 20, 2020 at 6:18 PM

    Thank you Patrick_R. That is great!

    What if I need it to be either https://www.youtube.com/ OR https://youtu.be to be allowed since https://youtu.be

    is the alternative URL For Youtube?

    Thank you!

  • Sonnyfer JotForm Support
    Replied on December 20, 2020 at 11:43 PM

    If that's the case, you can add the https://youtu.be in the condition set.

    1608525726 5fe0279e75e5c  Screenshot 10

    Here's a demo form where I applied the above condition: https://www.jotform.com/203548849148972

    Please review and let us know if you need further assistance.

  • reddittikihut
    Replied on December 21, 2020 at 12:52 AM

    Thank you Sonnyfer!!!
    And thank you for the extra step with the demo, so awesome of you.
    This totatlly fixes my dilemma for the 2 URLS but as I had asked elsewhere , what if I wanted to make the field optional?

    Meaning they can either leave it blank, or if they use it then they must use those 2 URLS is this possible?

    Thank you again for the amazing support!

  • Sonnyfer JotForm Support
    Replied on December 21, 2020 at 2:14 AM

    Glad to hear that we're able to fix your dilemma.

    What if I wanted to make the field optional? Meaning they can either leave it blank, or if they use it then they must use those 2 URLS is this possible?

    Unfortunately, there's no way to prevent submissions for such case. You can, however, consider adding a paragraph field on your form to show an error message if the input doesn't match the 2 URLs. See sample below:

    1608534654 5fe04a7e65856 asq Screenshot 10

    If this could for you, below is how it's done:

    1. Add a paragraph field with the error message you like to show1608534765 5fe04aeda870d  Screenshot 21
    2. Add the below condition to only show the error message if the URL input isn't youtube or youtu.be1608534829 5fe04b2d4e22f  Screenshot 32

    Link to the demo form above: https://www.jotform.com/203551275834961.

    Please do review and let us know if you need further assistance.

  • reddittikihut
    Replied on December 21, 2020 at 11:37 AM

    Thank you Sonnyfer!

    Just to make sure. It will only give a warning so someone could still ignore and click submit right?

    Would it make a difference if I limited to one IF - URL begins with "http://www.youtube.com"

    OR if is blank they can submit?

    Thank you! :)

  • Bojan Support Team Lead
    Replied on December 21, 2020 at 1:31 PM

    Greetings.

    Following my colleague's example, you can also add results if the conditions are true.

    That means that you can show the error message and hide the submit button:

    screenshot 3189 Screenshot 10

    This way, it would not be possible to submit the form unless all conditions are true.

    Let us know if this solution works for you.