"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee" between
apache-tapestry-5.7.1-sources.zip and apache-tapestry-5.7.2-sources.zip

About: Apache Tapestry is a framework for creating dynamic, robust, highly scalable web applications in Java. Source code.

forms.coffee  (apache-tapestry-5.7.1-sources):forms.coffee  (apache-tapestry-5.7.2-sources)
skipping to change at line 26 skipping to change at line 26
# #
# Defines handlers for HTML forms and HTML field elements, specifically to contr ol input validation. # Defines handlers for HTML forms and HTML field elements, specifically to contr ol input validation.
define ["./events", "./dom", "underscore"], define ["./events", "./dom", "underscore"],
(events, dom, _) -> (events, dom, _) ->
# Meta-data name that indicates the next submission should skip validation ( typically, because # Meta-data name that indicates the next submission should skip validation ( typically, because
# the form was submitted by a "cancel" button). # the form was submitted by a "cancel" button).
SKIP_VALIDATION = "t5:skip-validation" SKIP_VALIDATION = "t5:skip-validation"
# Data attribute and value added to HTML forms generated by the
# Tapestry's Form component from the core library.
DATA_ATTRIBUTE = "data-generator"
DATA_ATTRIBUTE_VALUE = "tapestry/core/form"
TAPESTRY_CORE_FORM_SELECTOR = "form[" + DATA_ATTRIBUTE + "='" + DATA_ATTRIBU
TE_VALUE + "']"
clearSubmittingHidden = (form) -> clearSubmittingHidden = (form) ->
hidden = form.findFirst "[name='t:submit']" hidden = form.findFirst "[name='t:submit']"
# Clear if found # Clear if found
hidden and hidden.value null hidden and hidden.value null
form.meta SKIP_VALIDATION, null form.meta SKIP_VALIDATION, null
return return
skipping to change at line 168 skipping to change at line 174
catch error catch error
console.error "Form validiation/submit error `#{error.toString()}', in f orm #{this.toString()}, #{where()}" console.error "Form validiation/submit error `#{error.toString()}', in f orm #{this.toString()}, #{where()}"
console.error error console.error error
return false return false
# Otherwise, the event is good, there are no validation problems, let the normal processing commence. # Otherwise, the event is good, there are no validation problems, let the normal processing commence.
# Possibly, the document event handler provided by the t5/core/zone module will intercept form submission if this # Possibly, the document event handler provided by the t5/core/zone module will intercept form submission if this
# is an Ajax submission. # is an Ajax submission.
return return
dom.onDocument "submit", "form", defaultValidateAndSubmit dom.onDocument "submit", TAPESTRY_CORE_FORM_SELECTOR, defaultValidateAndSubm it
# On any click on a submit or image, update the containing form to indicate that the element # On any click on a submit or image, update the containing form to indicate that the element
# was responsible for the eventual submit; this is very important to Ajax up dates, otherwise the # was responsible for the eventual submit; this is very important to Ajax up dates, otherwise the
# information about which control triggered the submit gets lost. # information about which control triggered the submit gets lost.
dom.onDocument "click", "input[type=submit], input[type=image]", -> dom.onDocument "click", TAPESTRY_CORE_FORM_SELECTOR + " input[type=submit], " + TAPESTRY_CORE_FORM_SELECTOR + " input[type=image]", ->
setSubmittingHidden (dom @element.form), this setSubmittingHidden (dom @element.form), this
return return
# Support for link submits. `data-submit-mode` will be non-null, possibly "c ancel". # Support for link submits. `data-submit-mode` will be non-null, possibly "c ancel".
# Update the hidden field, but also cancel the default behavior for the clic k. # Update the hidden field, but also cancel the default behavior for the clic k.
dom.onDocument "click", "a[data-submit-mode]", -> dom.onDocument "click", "a[data-submit-mode]", ->
form = @findParent "form" form = @findParent "form"
unless form unless form
console.error "Submitting link element not contained inside a form eleme nt." console.error "Submitting link element not contained inside a form eleme nt."
 End of changes. 3 change blocks. 
2 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)