How to create an embed widget (for personal use, not public)?

  • balajo
    Asked on September 5, 2016 at 2:24 AM

    I reworked the code from the substring widget to let it count lines in a textstring (only altered the function and left out unused variables). I went to http://developers.jotform.com/myapps and created a new widget, filled in some info, but where does the code goes ?

     For i-frame widgets, you can fill in a URL, but how to do it when choosing 'embed code' is unclear to me...

     

  • Chriistian Jotform Support
    Replied on September 5, 2016 at 4:25 AM

    When choosing direct embed, you will need to enter the code into the Widget Direct Embed Base Code area as seen below.

    How to create an embed widget (for personal use, not public)? Image 1 Screenshot 20

    Once you submit the form, it will be reviewed by the team. The widget will only be seen on the Widgets page once the widget has been approved. Please do note that once the widget is published, other users will be able to search for it and use it for their form.

    If you need further assistance, please let us know.
    Regards.

  • balajo
    Replied on September 5, 2016 at 8:11 AM

    Ah, I see, for some reason my 'Setup Widget' page shows less options: only  'Ask for embed code'  and  'iFrame Widget'.

    How to create an embed widget (for personal use, not public)? Image 1 Screenshot 20

    What do I have to change to get more 'Widget Type' options ?

    Browser: Firefox 48
    OS: Xubuntu 16.04.1

    Thanks ...

     

  • Chriistian Jotform Support
    Replied on September 5, 2016 at 9:32 AM

    Hi,

    That is odd. Were you logged into your account when you accessed the page? If you are logged into your JotForm account, you should see the page with the same options as the screenshot I have posted above.

  • balajo
    Replied on September 5, 2016 at 11:23 AM

    I am logged in and can create forms. Do I need a different login as developer ?

    URL  http://developers.jotform.com/widgets/new  still gives me limited options ...

  • Chriistian Jotform Support
    Replied on September 5, 2016 at 11:46 AM

    Sorry for the confusion. As per further checking, the other options that I have shown for the Widget Type is only available for JotForm Admins (support or developers).

    How to create an embed widget (for personal use, not public)? Image 1 Screenshot 30

     

    You can only use the following options as Widget Type.

    How to create an embed widget (for personal use, not public)? Image 2 Screenshot 41

  • balajo
    Replied on September 5, 2016 at 12:04 PM

    Aha, I see.

    I wanted to make a simple function to count lines in a string, based on the Substring widget. Which isn't much work because only the function in the script has to be modified (beneath two user input fields that aren't necessary anymore:

    -    var substringStart;
    -    var substringEnd;
    ...

    -    substringStart = parseInt(window.substringStart) || 0;
    -    substringEnd   = parseInt(window.substringEnd)   || 0;
    ...

    -    $(inputId).value = value.substring(substringStart, substringEnd);
    +   var lines = value.split(/\r|\r\n|\n/);
    +   $(inputId).value = lines.length;

    That way it would be possible to count the number of rows in a configurable list. Either directly or with the help of a intermediate text box (I suppose ...).

    The Substring widget is an 'Embed Code' widget, I suppose. I am not sure if I can use the same code to create an iFrame Widget.

    Some advise ?

     

    Bart.

     

     

  • Chriistian Jotform Support
    Replied on September 5, 2016 at 12:51 PM

    Hi,

    As I understand, you need to modify the code above to make a function that counts lines in a string. I think the last 2 lines of the code counts the lines in a string.

    +   var lines = value.split(/\r|\r\n|\n/);
    +   $(inputId).value = lines.length;

    However, I am not quite sure where the value comes from. Can you please give the whole code for the function or point me to where you have taken the code. I will try to check.

  • balajo
    Replied on September 5, 2016 at 12:59 PM

    The Substring widget is a JotForm widget: https://widgets.jotform.com/widget/substring

     

  • Ashwin JotForm Support
    Replied on September 5, 2016 at 1:57 PM

    Hello balajo,

    Please note that it is not possible to add any custom script code in form. The only possibility is to download your form's full source code and then add your cusotm script code. 

    The issue here is that you want to read data of the widget and then pass it to another widget for further calculation. Please note that all widgets loads inside its own iFrame and that will prevent you to use custom script for any widget.

    What exactly you want to achieve here? Do you want to count the length of the string of any particular cell of configurable list widget?

    Thank you!

  • balajo
    Replied on September 5, 2016 at 2:26 PM

    I made a showcase : https://form.jotform.com/62485584467369

    I want to get the number of rows in the Configurable List so I can do some calculation on it.

    The Substring widget can work with the data from the Configurable List. It only needs a little modification to make it calculate the number of rows (see my suggestion above).

    My first try was with CSS content & counter, but it doesn't come into the result (as it is 'formatting', not 'content').

    I had hoped to fix some widged (for personal use) unless others are also interested ...

     

    If you have any suggestions how to proceed ?

    Thanks !

     

     

  • Mike_G JotForm Support
    Replied on September 5, 2016 at 4:25 PM

    I have tried to check for any possible way or see if there is any workaround that we can use so we can get the total number of rows in a particular Configurable List widget, but I was not able to find any. 

    You can create a widget base on the Substring widget, however, like what my colleague, Chriistian, have mentioned above it will still be subjected to being approved. 

    Since it is not possible to add any custom scripts to forms, the only way you can do to pull this off, I think, is to follow what my colleague, ashwin_d, have instructed you to do which is get the form's Full Source code and inject your custom scripts there.