• Resolved Charlene

    (@cmspencer99)


    I have a set of text fields for day, month, year as a custom date of birth field. I also have a hidden field which I need to update with these values when the form is submitted, but before the form does the full submission.

    I have tried both a maybe:submit and a submit:response but neither of these appear to do anything. There is not even a console log. Any ideas what I am doing wrong and how I can resolve the issue?

    var mySubmitController = Marionette.Object.extend( {
      initialize: function() {
        Backbone.Radio.channel( 'forms' ).reply( 'maybe:submit', this.beforeSubmit);
    	  console.log('init'); << this one does
      },
      beforeSubmit: function( response ) {
          let day = jQuery( '#nf-field-60' ).val();
    	  let month = jQuery( '#nf-field-61' ).val();
    	  let year = jQuery( '#nf-field-62' ).val();
    	  let dob = year +'-'+ month +'-'+ day;
    	  jQuery( '#nf-field-69' ).val(dob);
    	  console.log(jQuery( '#nf-field-69' ).val()); << this one doesn't
      },
    });
    • This topic was modified 4 years, 9 months ago by Charlene.

The topic ‘Update value on submit before submission’ is closed to new replies.