BomAle Posted March 29, 2017 Share Posted March 29, 2017 @Rikki @Mark can you or others show me a example to got updated serialized input for javascript ckeditor and codemirror? I don't see any example here: https://invisionpower.com/4guides/themes-and-customizations/javascript-framework/using-utility-modules/ but I have found some example from streams controller like: this._formData = ips.utils.form.serializeAsObject( this.scope.find('form'), this._serializeConfig ); where this._serializeConfig = { 'stream_date_range[start]': this._serializeDate, 'stream_date_range[end]': this._serializeDate }; /** * A function which will be passed into the serializeAsObject function so that * we can format dates consistently as YYYY-MM-DD. * MUST return a string. * * @param {string} name Name of form field * @param {string} value Value of form field as returned by jQuery's serializeArray() * @returns {string} */ _serializeDate: function (name, value) { // If we're an HTML5 browser, dates are already in YYYY-MM-DD format, so we can return if( ips.utils.time.supportsHTMLDate() ){ return value; } var dateObj = ips.utils.time.getDateFromInput( $('input[name=' + ips.utils.css.escapeSelector( name ) + ']') ); // Nothing if this isn't really a date if( !ips.utils.time.isValidDateObj( dateObj ) ){ return ''; } // Format the date to YYYY-MM-DD var month = ( '0' + ( dateObj.getUTCMonth() + 1 ) ).slice( -2 ); var day = ( '0' + ( dateObj.getUTCDate() ) ).slice( -2 ); return dateObj.getUTCFullYear() + '-' + month + '-' + day; } OR can i trigger some event to get updated before call ips.utils.form.serializeAsObject? ps I have 4.1.18.2 Link to comment Share on other sites More sharing options...
BomAle Posted March 29, 2017 Author Share Posted March 29, 2017 solved for ckeditor calling: try { if( !_.isUndefined( CKEDITOR ) && CKEDITOR != null ){ for( var instance in CKEDITOR.instances ) { CKEDITOR.instances[ instance ].updateElement(); } } } catch (err) { } also for codemirror with: ips.ui.form.respond($('#bacalltoactionpopup_template')); if there is other best solution please report here Link to comment Share on other sites More sharing options...
BomAle Posted April 1, 2017 Author Share Posted April 1, 2017 updated with: // trigger to interact with form widget instead call ips.ui.form.respond($('#bacalltoactionpopup_template')); $(document).trigger('contentChange', ['#bacalltoactionpopup_template']); try { if( !_.isUndefined( CKEDITOR ) && CKEDITOR != null ){ for( var instance in CKEDITOR.instances ) { CKEDITOR.instances[ instance ].updateElement(); } } } catch (err) { } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.