Uploaded image for project: 'Survey'
  1. Survey
  2. SURVEY-51

Back to top when there are errors in the form

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.2.0
    • None
    • None
    • None

      When there is an error in the form, we stay on bottom of the page (where is the button) instead of going back to top (where is description of the error).

      How to reproduce :

      • Create a survey with some field in order to need scrolling
      • Declare some fields mandatory
      • Don't answer to a mandatory field
      • Clic on submit button : you stay near the submit button and you cannot see the error

      A part of the patch here (do not take account of about the liseret div) :

      <script type="text/javascript">
      			function survey_display_errors (id, pos, errors)
      			{
      				$j($j('#survey-' + id + '-page-' + pos + ' .liseret')[0]).before('&lt;div class="error"&gt;&lt;a name="errors"&gt;&lt;/a&gt;<i18n:text i18n:key="PLUGINS_SURVEY_FORM_ERRORS"/>&lt;ul&gt;&lt;/ul&gt;&lt;/div&gt;');
      				for (var i=0; i &lt; errors.length; i++)
      				{
      					$j('div.error ul').append('&lt;li&gt;' + errors[i].label + " : " + errors[i].message + '&lt;/li&gt;');
      				}
      				window.location.href = "#errors";
      			}
      		</script>

            Unassigned Unassigned
            llopez Laure Lopez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: