FormError.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {namespace vh=In2code\Powermail\ViewHelpers}
  2. <f:form.validationResults>
  3. <f:if condition="{validationResults.flattenedErrors}">
  4. <nav class="powermail_message powermail_message_error" aria-label="{f:translate(key: 'validationerror_container_label')}">
  5. <h2><f:translate key="validationerror_title" /></h2>
  6. <ol>
  7. <f:for each="{validationResults.flattenedErrors}" as="errors">
  8. <f:for each="{errors}" as="singleError">
  9. <li>
  10. <f:if condition="{singleError.message} == 'spam_details'">
  11. <f:then>
  12. <f:comment>
  13. Show spam message
  14. </f:comment>
  15. <f:translate key="validationerror_spam" /> {singleError.arguments.spamfactor}
  16. <f:translate key="validationerror_{singleError.message}">{singleError.message}</f:translate>
  17. </f:then>
  18. <f:else>
  19. <f:comment>
  20. Show field error message
  21. </f:comment>
  22. <f:if condition="{singleError.arguments.marker}">
  23. <f:if condition="{vh:getter.getFieldPropertyFromMarkerAndForm(marker: singleError.arguments.marker, form: form, property: 'type')} == 'check'
  24. || {vh:getter.getFieldPropertyFromMarkerAndForm(marker: singleError.arguments.marker, form: form, property: 'type')} == 'radio'">
  25. <f:then>
  26. <f:comment>
  27. "Hack" to link to the first checkbox/ radio
  28. </f:comment>
  29. <a href="#powermail_field_{singleError.arguments.marker}_1">
  30. <vh:getter.getFieldPropertyFromMarkerAndForm marker="{singleError.arguments.marker}" form="{form}" property="title"/>:
  31. <f:if condition="{vh:getter.getFieldPropertyFromMarkerAndForm(marker: singleError.arguments.marker, form: form, property: 'mandatory_text')} !== ''">
  32. <f:then>
  33. <f:comment>
  34. Show custom error message
  35. </f:comment>
  36. {vh:getter.getFieldPropertyFromMarkerAndForm(marker: singleError.arguments.marker, form: form, property: 'mandatory_text')}
  37. </f:then>
  38. <f:else>
  39. <f:comment>
  40. Show default error message
  41. </f:comment>
  42. <f:translate key="validationerror_{singleError.message}">{singleError.message}</f:translate>
  43. </f:else>
  44. </f:if>
  45. </a>
  46. </f:then>
  47. <f:else>
  48. <a href="#powermail_field_{singleError.arguments.marker}">
  49. <vh:getter.getFieldPropertyFromMarkerAndForm marker="{singleError.arguments.marker}" form="{form}" property="title"/>:
  50. <f:if condition="{vh:getter.getFieldPropertyFromMarkerAndForm(marker: singleError.arguments.marker, form: form, property: 'mandatory_text')} !== ''">
  51. <f:then>
  52. <f:comment>
  53. Show custom error message
  54. </f:comment>
  55. {vh:getter.getFieldPropertyFromMarkerAndForm(marker: singleError.arguments.marker, form: form, property: 'mandatory_text')}
  56. </f:then>
  57. <f:else>
  58. <f:comment>
  59. Show default error message
  60. </f:comment>
  61. <f:translate key="validationerror_{singleError.message}">{singleError.message}</f:translate>
  62. </f:else>
  63. </f:if>
  64. </a>
  65. </f:else>
  66. </f:if>
  67. </f:if>
  68. </f:else>
  69. </f:if>
  70. </li>
  71. </f:for>
  72. </f:for>
  73. </ol>
  74. </nav>
  75. </f:if>
  76. </f:form.validationResults>