page load logic - need help with JavaScript
Last Post 04-09-2012 07:06 AM by Matt. 2 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Susan RobbinsUser is Offline
new to the springs
new to the springs
Posts:1
Avatar

--
01-31-2012 12:49 PM
    I'd like to make sure my form is cleared/reset whenever the page is reloaded, so I added some initial JavaScript.  Some of it works, and some doesn't.

    Clearing checkboxes does not work, so I'm hoping someone can explain what I'm doing wrong.  Here's the syntax I'm using:
    document.getElementById('shortname').checked = false;

    I also want to reset comboboxes to the first element, but my JavaScript for that doesn't work either:
    document.getElementById('shortname').selectedIndex = 0;






    David LoofbourrowUser is Offline
    wading in the water
    wading in the water
    Posts:17
    Avatar

    --
    04-06-2012 03:21 PM
    Hi fellow user ~

    I am not sure what you really mean by "page is reloaded" but I will answer on the assumption that you mean "after a user has submitted the form, and the focus is returned to the same page after the save."

    I faced this issue with a whole series of forms where the end users will be entering data repeatedly.

    I think this solution is best, because it does not require you to do gymnastics with JavaScript and it gives success feedback to the user.

    Before you start this, navigate to your form page and copy the URL to your clipboard.

    1. In your form's General Settings, set "Display message to user after initial save?" to checked.

    2. Just below that field, set the "Link text to continue" to something like "Click here to finish"

    3. Several settings lower, find the "Redirect Page After Save" control. Set it to link type option "URL" and paste the url of your form here. NOTE: The DynForms will not let you select the form's page in the "Page" option.

    4. Save the settings. Then return to Module Configuration (I know, but I am careful...)

    5. Under the "Header / Footer / System Messages" in the drop down " System Layout / Email Messages" select the "Display after Save Message" option.

    6. There you can format a complete thank you page for the form, or simply say that the record (using tokens to be explicit) has been saved. The previously set text for the "continue" link will be displayed under whatever you put in this HTML box.

    7. BE SURE TO CLICK the "Update Message" under the HTML editor. Clicking the overall Update Settings will not save your message text.

    That should be all you do.

    Now, when your user completes the form, the form will hide and the Thank You message will display. When they click the "Finish" link, the navigation does a full screen refresh (because our redirect was a full path URL) and the form will be completely blank without any effort to clear fields by code.

    Hope that answers your problem!

    David
    MattUser is Offline
    skipping stones
    skipping stones
    Posts:6
    Avatar

    --
    04-09-2012 07:06 AM

    Hello David,


    This post was extremely informative and helpful!




    Thank you!



    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi