How can I add custom javascript?

  • rstober
    Asked on August 18, 2016 at 8:48 PM

    I saw read a post where someone was saying "add this custom javascript" to solve a certain problem. But given that the code is all hosted on jotform servers, how does one do that?

    My only thought is to download the source code and then add my own script tag, which I could do. But then every time save I'll have to copy the source and re-paste into my local copy, avoiding my custom code along the way. So I figure, there must be another way I'm over looking?

    Also, I was surprise to see that with such a wide-range of high quality form field to choose from, I did not see a password form field, which would actually be two text field that should have the exact same characters (we've all see them and coded them I'm sure). But no password field type?

    Which brings to the subject of customer validators. Is there away for me to add additional validators? In particular, an IP address validator?

    The input masks are a great idea; they're kind of like client side validators on their own. But what if I want to make a variable number of characters for example #+ (one or more numbers), kind of like a regular expression?

    Is there a way to put more then one form field per line. I know there are custom controls that do that, but they don't support the same field types that are available in the rest of the product, don't support the hover help text, and I cannot write values collected earlier in the form to them (per the next paragraph). So Why can't I put two or three form controls on the same line? That might solve my problem.

    This is the biggest problem of them all. I collect information in various form fields, and then I want to write all of them to a form control. I'm specifically talking about the domain names, but it applies to a few things. I was able to add them all to a text area, but they were concatenated without even spaces in-between. That's not going to work. I need to be able to put them into a form control where they can be easily viewed and edited. I think I'm going to need some custom work here. Does anyone provide that service economically? My form is quite complicated, and necessarily so.

    I really like your form generator, but there are just few features missing. I fear that if i cannot overcome these I will have spent an entire day building a very elaborate form that in the end, I won't be able to use.

    Thank you,

    Robert

  • Elton Support Team Lead
    Replied on August 19, 2016 at 12:25 AM

    Hello Robert,

    1. To answer your question, the only way to add custom Javascript to the form is to use your form source code https://www.jotform.com/help/104-How-to-Download-a-Source-Code-of-your-Form. There's no other way to do it other than this. You're right that the downside with using source code is to update them whenever you made changes to your form in the form builder.

    Note that embedding custom Javascript to your form in the form builder is not possible. It will be stripped off for security reasons, one is due XSS attacks.

    2. We no longer support password field. We also do not allow login forms (forms with username and password field combination). They are constantly used by phishers for their illegal activities so we decided to remove it.

    Please do not attempt to create login forms or similar using regular textbox fields, otherwise, our anti-phishing tool will auto-suspend your account.

    3. If you want custom validations, we suggest to implement it in your form source code.

    However, if you want to limit submissions per IP, you can enable unique submission in your form preferences https://www.jotform.com/help/64-What-does-Unique-Submission-Mean?.

    4. We do not have regular expression feature but you can implement it in your form source code.

    With input mask, you can use @ symbol to mask letters, # for numbers and * for both. Other than that are fixed numbers/symbol.

    5. There are few ways to achieve this. It's either using multiple fields and shrink them, using full name field or use widgets like narrative fields. There's a lot more you can find here http://widgets.jotform.com/.

    6. This is possible by creating an Update/Calculate condition.

    Example:

    How can I add custom javascript? Image 1 Screenshot 20

    Demo: https://form.jotform.com/62308450174956

    I believe most of the features you're looking for is available in the form builder. If there are specific features you're looking for, we can submit that as a feature request but take note that requests have priorities depending on the no. of users requesting them. Sometimes it would take months or years to be implemented. However, if there's any available workaround, we will be more than happy to provide you instructions.

    On another note, please understand that we are bound to answer one question per thread. Since you have multiple questions on this thread, we may split them into a separate thread if you have any follow-up questions with any of the above questions to avoid confusions.

    Thanks for your understanding!