How can I create a custom message to display when a form is disabled?

  • sjpd
    Asked on May 28, 2015 at 7:31 PM

    My user wants to be able to close an javascript embedded and secure jotform periodically for administrative reasons.  If I disable the form and try to view it in the page where it has been embedded, nothing displays at all.

    This behavior is likely to result in users phoning to ask why the form is unavailable or missing.

    I'd like to be able to say something more meaningful when a form is disabled, and have that message displayed when the form is embedded in my website.

     

    Example Closed Message:

    Due to overwhelming demand, this form is currently closed and not accepting new submissions at this time.  

    Please try to access this form again after the first of next month.

     

    Adobe Formcentral had a nice feature that allowed each form to have its own "Closed" message.  And that message would display when a closed form was loaded using their embed code.

    Can we do this with JotForm?

    If not, can you add this feature please?

    In the meantime, is there a workaround to detect the closed message using Javascript from the parent web page when Jotforms are embedded, and conditionally unhide a banner that explains why the Jotform is unavailable?

     

    I need this feature very much.

     

    Thanks,

     

    -Dave

     

  • sjpd
    Replied on May 28, 2015 at 9:38 PM

    I really need the facility to have a custom message appear in the Jotform when embedded in my web page template.  After some investigation it seems that the Javascript that is included in the embedded form collapses the frame when it is inside a parent container.  So nothing at all appears on my page when the Jotform is disabled, not even the message that says the form is disabled.

    I've developed a kludgey workaround for this issue.  I use a javascript to test the height of my Div that surrounds the Jotform embed code.  And if the height is too low, my Javascript inserts a custom message.

    But this is a kludge...  Please let me know if you can add a feature to enable custom "Closed" messages for each form, that WILL display in embedded forms.

     

    Here is my javascriptDISABLED:

    <script type="text/javascript">//<![CDATA[
    /* Check if the div containing the Jotform is tall enough to confirm the form is available, if not, insert a Form Closed message */
    function getHeight(myID) {
    var Msg = '<div style="padding:60px 120px">'
    Msg += '<h4 style="margin:0 0 30px; text-align:center">The Ride-Along Form Has Been Closed Temporarily.</h4>'
    Msg += '<p>Due to overwhelming demand and the current police staffing shortage, the Ride-Along calendar is currently full to capacity.</p>'
    Msg += '<p>Please check here again after the first of next month to check if this form has been re-opened.</p>'
    Msg += '<p>We are working hard to accomodate all Ride-Along requests, however new Police Recruit Applicants will be given priority scheduling.</p></div>';

    var clientHeight = document.getElementById('embeddedform').clientHeight;
    if (clientHeight < 500) {
    //alert("Hey Dave " + clientHeight);
    document.getElementById('embeddedform').innerHTML = Msg;
    }
    return clientHeight;
    }
    setTimeout(function() { getHeight(); }, 1000);
    //-->
    //]]></script>

  • Charlie
    Replied on May 29, 2015 at 1:25 AM

    You can disable your form by following this guide: http://www.jotform.com/help/180-How-to-Enable-Disable-a-Form. If you want to change the warning message, you can do that by changing it in the Preferences->Form Limits.

    How can I create a custom message to display when a form is disabled? Image 1 Screenshot 50

     

    I believe you can also achieve this by using conditional logic. In my case, I'll hide all the fields, including the submit button so that users will not be able to submit anything, at the same time, I'll display a message about it.

    Here's my sample form: http://form.jotformpro.com/form/51480669956975?. The form fields and the submit button will only display if the current date of the user is after July 1, 2015.

    1. I'll add a DateTime field that will identify current date of user. I will then use the "Text" field founder under "Form Tools" section that will be used as the warning message.

    How can I create a custom message to display when a form is disabled? Image 2 Screenshot 61

    2. In the conditions wizard, I'll select "Show/Hide a form field".

    How can I create a custom message to display when a form is disabled? Image 3 Screenshot 72

    3. Here's the list of conditions that I have.

    How can I create a custom message to display when a form is disabled? Image 4 Screenshot 83

     

    I hope that helps. Do let us know if this works.

    Thank you.

  • sjpd
    Replied on May 29, 2015 at 11:39 AM

    Thank you for your suggestions.  I tested the conditional feature to display a Closed Form message and hide the remainder of the form based on a date test.  I was NOT able to select multiple fields to hide.  For some reason it would not allow me to save the conditional rule when I selected multiple fields to be hidden.  I had to select every field individually. 

    Can you tell me why it would not allow me to select multiple hidden fields in a single action?

    The form I tested was: http://form.jotformpro.com/form/51478448051963

    I attempted to select ALL fields except the new text field that contains the closed message.

    Thanks!

     

    -Dave

  • Kiran Support Team Lead
    Replied on May 29, 2015 at 12:30 PM

    Hello Dave,

    As I check your JotForm, I see that each field is selected to show or hide in the condition wizard. I see that you have selected Show instead of Show Multiple when the condition is satisfied which is not allowing you to selecting Hide Multiple. Please select Show Multiple and Hide Multiple in both cases.

    How can I create a custom message to display when a form is disabled? Image 1 Screenshot 20

    Hope this information helps. Please get back to us if you need any further assistance. We will be happy to help.

  • sjpd
    Replied on May 29, 2015 at 4:29 PM

    Thank you for your kind and helpful suggestions.

    I implemented the Multiple "Show" and Multiple "Hide" rules as suggested.  

    Here is the live, embedded form (currently closed).  https://www.sjpd.org/_forms/ride-along.asp

    I notice there is a lag where the form is displayed and then hidden and replaced by the closed message.  I will experiment in changing the order of my rules to see if I can affect that lag.

    It was not evident to me that if there are two actions in a rule, where one needs to affect multiple fiields, that both actions must use the multiple field action, even if only one field is included in that action.  But now I know...

    Of the two options you offered,

    1.) changing the Preferences->Form Limits ->Warning Message or

    2.) using conditional rules based before or after a date,

    I chose option 2.  This allows me to automate the closing and opening of the form based on a date my users can manage themselves. And that's more efficient for me.  

    But I suspect that option #1 would not work on embedded forms.  When I tested my form after disabling it, the warning did not appear in the embedded page.  It DID appear when the form was viewed on Jotform.  

    I examined the source code of the embedded webpage using Firebug and noticed there is a javascript generated by Jotform, that collapses the form when it is disabled and displayed embedded within another parent page.  

    For this reason I suspect that method #1 (above) may not work if the Jotform is embedded using the embed code.  (But I did not test this theory, since the conditional rules based approach provided better automation in my use case).

    Thanks so much for your excellent support.  For every obstacle I encounter, you seem to always come up with a solution.

    Regards,

    -Dave Bartholomew

     

     

  • raul
    Replied on May 29, 2015 at 5:31 PM

    For the option 1, you would need to embed the form using the iframe method in order to be able to see the message. Based on my testings the JS method returns a 404 error which results in a blank page.

    But, since you prefer to use method #2 then you should be good to go.

    For the lag, you might also try using Form Collapse to show/hide multiple fields as described here: http://www.jotform.com/help/297-Show-or-Hide-multiple-fields-at-once-using-form-collapse-tool

    Let us know if you need further assistance.

  • sjpd
    Replied on June 2, 2015 at 6:15 PM

    Thank you for the tip on Form Collapse sections.  That really is an elegant way to define sections of a form to be hidden or displayed conditionally, without needing to select all the multiple fields individually in conditional rules.

    Point of Information:

    When I implemented the Form Collapse to show my custom "Form Closed" message and hide the rest of the form entirely based on a date condition, I now find that I am unable to use the form designer to access the hidden portion of the form, even when the date condition is adjusted to display the form.

    It is worth noting that once a form collapse section's status has been set to "Closed", it becomes invisible in the Form Designer.  You must change the form collapse status to "Open" to see that form content in the designer, make edits to the CSS, and then reset the form collapse back to a "Closed" status.  

     

     

  • raul
    Replied on June 2, 2015 at 6:27 PM

    Thank you for letting us know about this.

    Basically, this is happening because the form designer will show you a live version of your form so you can see how your users will see the form when it's live. The purpose of the designer is to help you to easily customize your form with a few clicks and then use the form builder to manage all the logic of your form like the conditions, calculations, etc.

    Again, we appreciate your input about this and hope this helps to clarify why this is happening.

    Let us know if we can be of further assistance.