Has any body use that code ??? Calculate final date

By: Nicolas Stergio | Asked: 03/10/2023
ForumsCategory: Code SnippetsHas any body use that code ??? Calculate final date
Nicolas Stergio asked 1 year ago
It is on this page https://formidableforms.com/knowledgebase/javascript-examples/#kb-calculate-final-date   i have done all the changes but it is not working for me that is my code All field ids are correct. check it 3 times <script type="text/javascript">
$('#field_siq5u, #field_1jta1').change(function(){

var addDays = $("#field_siq5u").val();
var dateOneString = $("#field_1jta1").val();
if ( addDays === '' || dateOneString === '' ) {
} var finalDate = $("#field_1jta1").datepicker( 'getDate' );
finalDate.setDate(finalDate.getDate() + parseInt( addDays ) ); $("#field_yeatz").focusin();
$("#field_yeatz").datepicker("setDate", finalDate);
$("#field_yeatz").change(); });
Victor Font replied 1 year ago

What's not working? It's impossible to say from your code. Have you confirmed through step debugging that both the addDays AND dateOneString have values? If either one has an absence of value, you'll hit the return and nothing will happen. You may want to try the Kint debugger available in the WordPress plugin repository to help you with step debugging to make sure every one of the lines is returning a correct value.

Nicolas Stergio replied 1 year ago

Thanks i also agree that is correct. i will use the debugger thanks a lot.

Nicolas Stergio replied 1 year ago

the are some problems in console but the are all from formidable forms

1 Answers
Nicolas Stergio answered 1 year ago
another question that code suppose after we hit enter???  
Victor Font replied 1 year ago

jQuery code executes in the browser. You do not have to hit enter. What are the errors you're seeing in the console?

Nicolas Stergio replied 1 year ago

Thanks a lot i make it work

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community