You are viewing limited content. For full access, please sign in.

Question

Question

When I press Save under SAVE DRAFT, it does not do anything?

asked on October 25, 2015

Hi

 

I have already configured email settings from Forms configuration section also enabled the save draft option for the form but I can't save a draft copy of the form.   I put the email address and press save it just stays solid (does not lock up) and doesn't do any thing:

I created a new test form and enabled the save draft it worked fine. 

 

The form with the problem is an active form that has been in production for last one year and I am just enabling Save Draft option.   

 

I have a script under java section if I take it out, Save Draft works but  when I load saved draft copy I don't see submit button any more, the code is: (There are two additional code statements that I will include at the end of this screen)


/* $(document).ready(function () {

    $('form').submit(function (ev) {

      if (($("#q215 input").val() = "") &&($('#q1 option:selected').val() == "Field Activity Submission"))
      {

            ev.preventDefault(); alert("Last Activity Has been Submitted. Please Check-In before submitting another Field Activity.");


        }

   

else

            $(this).unbind('submit');
            

    });


});

$(document).ready(function () {

    $('form').submit(function (ev) {

      if (($("#q215 input").val() == "") && ($('#q1 option:selected').val() == "Check-In Submission"))
      {

            ev.preventDefault(); alert("Your last Check-In Submission is pending.  Please Submit Activtiy to complete .");


        }

   

else

            $(this).unbind('submit');


              

    });


}); */

 

 

 

What could be causing this? How can I fix this?

 

Appreciate the help.....

 

There are two additional script, I will paste them all below:

$(document).ready(function() {
 
   //cache the elements we will use
   var $submit = $('.Submit');
   var $Field1 = $('#q1');
 
 
   //hide the submit button
   $submit.hide();
 
   //bind event handler to the dropdown field
  $Field1.change(function() {
     
      
     //if the user selects what we want, show the submit button
     if($Field1.find(':selected').val() === "Select an Activity...")  {
            
       $submit.hide();
       
      
      
     
   }
    
    
         //if not, hide it
     else {
       
       $submit.show();
     }

    });
       });

 


$(document).ready(function () {

    $('form').submit(function (ev) {

      if (($("#q215 input").val() = "") &&($('#q1 option:selected').val() == "Field Activity Submission"))
      {

            ev.preventDefault(); alert("Last Activity Has been Submitted. Please Check-In before submitting another Field Activity.");


        }

   

else

            $(this).unbind('submit');
            

    });


});

$(document).ready(function () {

    $('form').submit(function (ev) {

      if (($("#q215 input").val() == "") && ($('#q1 option:selected').val() == "Check-In Submission"))
      {

            ev.preventDefault(); alert("Your last Check-In Submission is pending.  Please Submit Activtiy to complete .");


        }

   

else

            $(this).unbind('submit');


              

    });


});

 

    
    
 

 

 

 


    
    

    $(document).ready(function(){
   
  function setcurrenttime (){
      var currentdate=new Date();
      var datetimenow=(currentdate.getHours())+ ":"
        + currentdate.getMinutes();
    
    
    
    
      $('#Field280').val(datetimenow);
      }
      setcurrenttime();
      
     
});
 

 

 

 

 

 

 

0 0

Replies

replied on October 28, 2015

Hi Farzali,

The reason you don't see the Submit button when you load a draft is that the $(document).ready functions run every time the form is loaded, meaning $('.Submit').hide() runs. Javascript will not show the Submit button until the ('form').submit function is run.

For the "Save Draft" feature, I tested your code and I get the same error. However, the $('form').submit parts were not working for me (the ev.preventDefault let the form be submitted anyway) so I replaced it with $('.Submit').click. I then changed the "else" statement to else{$(this).show();}. For example:

$('.Submit').click(function (ev) {
    
  if (($("#q5 input").val() == "") &&($('#q2 select').val() == "Field Activity Submission")){
       
    ev.preventDefault(); 
    alert("Last Activity Has been Submitted. Please Check-In before submitting another Field Activity.");
  }

  else $(this).show();
});

This had the same functionality and let me save a draft of the form. 

Let me know if this solves the issue and keeps your form functioning.

0 0
replied on November 1, 2015 Show version history

Hello Alexander,   thanks for the reply...

 

I implemented your changes to the script but it did not change anything.    It works fine as desired when I work with the form but when I go to draft to launch saved draft ,  submit button doesn't show.    It will only show submit button if I change "Select Activity" drop down values.    I need it to show when the page loads.   

 

So far I have been able to only show the submit button on click or change.      

0 0
replied on November 4, 2015

Hello Farzali,

When your Javascript loads, you automatically hide the Submit button until the fields change. Instead. you could let the Submit button show, and only let someone submit when the fields are correct. Each time someone clicks Submit, you would run the "function(ev)". 

Another route would be to check at "%(document).ready" to see if those fields are correct, and if so, show the submit button.

 

 

0 0
replied on November 4, 2015 Show version history

I changed to submit button to show on load, now it shows form's landing page where the drop down field is: "Select an Activity...", and If the user presses the submit button the forms goes through.  I don't mind it if the user could see the button but couldn't submit.    This is like having no code as all.   

 

Over all the code works fine when users do their regular submission where they start changing the drop down field which triggers script to show Submit button.   But this contradicts Loading from Draft which does not necessarily land in the form's original landing pages.    

 

I am not a developer but in addition for the statement to show or hide when field changes, I think we need another statement to evaluate the field values and hide or show the submit button when loading the page.   Currently on load we are either showing or hiding regardless of the values in the field and this setup works for one but not both?

 

0 0
replied on November 12, 2015 Show version history

Alexander

Do you have any further suggestions?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.