How can I add custom data attributes to form fields?

  • Profile Image
    Gustavo 
    Asked on January 10, 2020 at 05:30 AM

    Hi Jotform team,

    I’m looking for a form solution for a project in working on and came across JorForm recommended by some friends.

    for this specific project I’d need to add custom data attributes to a dorm field.


    For example:


    <input type="text"name="fname" ms-profile=“update”>


    Would it be possible to add this ms-profile=“update” attribute to an input tag?


    Thank you,

    Gustavo

  • Profile Image
    gerardw
    Answered on January 10, 2020 at 08:16 AM

    Hello Gustavo,

    Where would you like to add this code to your form? Please note that it will not be possible to add external codes into the form's source code. The form can be customized using CSS codes though.

  • Profile Image
    gusvd
    Answered on January 10, 2020 at 08:21 AM

    Hi Gerard, thanks for the quick reply!

    I'm trying to use Jotform with Memberstack.io, which a platform to manage member subscriptions.

    To link the form to their system I need to add some custom attributes to the <form> and <input> tags.


    For example, this is how a normal input filed tag looks like:

    <input type="text" id="input_1" name="fname">


    I need to add the custom attribute 'ms-profile=“update”' to the tag to link it to Memberstack. Resulting in something like this:


    <input type="text" id="input_1" name="fname" ms-profile=“update”>


    Thank you!

  • Profile Image
    gerardw
    Answered on January 10, 2020 at 09:45 AM

    Thank you for the clarification.

    I'm afraid that it is not possible to reference an external data source in the form.

    But you can use the full source code of the form - https://www.jotform.com/help/104-How-to-get-the-Full-Source-Code-of-your-Form and add it to your web page. Then add these attributes on the form added to your webpage.

    I hope this helps.