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

Question

Question

Bypass required field

asked on February 27, 2014

I have created a form that when submitted it gets routed back to the initiator, it then passes through an exclusive gateway with options to 1. save again, 2. submit for approval or 3. reject by the initiator. This works as a save function and allows the saved form to appear in Tasks as apposed to an email. When the user is ready to submit they can choose the submit button and same with reject. The form has required fields in it.

 

 I would like to know how i would do the following.

 

When clicking save button it must bypass the required fields, when clicking submit button it must then use required fields. This is so the user can save the form without filling in the required fields but cannot submit until all the required fields are populated

0 0

Answer

SELECTED ANSWER
replied on February 27, 2014 Show version history

Thanks Chris and Eric!

 

But i need the user to be able to save the form as they go into remote areas and loose internet connectivity. If there are required fields, the user cannot save. 

 

I used part of the solution  below to create custom buttons and actions for the process modeler to follow

 

http://answers.laserfiche.com/questions/48811/Button-control-not-found-in-Forms

 

I made the button a submit action and have hid the standard Laserfiche buttons in CSS  using

.Submit {display:none;}

 

So now I am using my own buttons via custom HTML ( as per below) and have added a formnovalidate to the save button so it does not prompt for require fields to be entered when saving.

 

<input class="saveButton" value="   Save   " type="Submit" formnovalidate="">
<input class="submitButton" value="  Submit  " type="Submit">
<input class="deleteButton" value="  Delete  " type="Submit">

 

This seems to be working great !

 

1 0
replied on February 27, 2014

With the solution I suggested earlier, you wouldn't have any fields marked as read-only and would instead just use JavaScript to enable or disable the submit button based on field values.

 

You mentioned losing internet connectivity as an issue. Forms does not have an offline mode, so users will be unable to perform actions (submit, approve, reject) on forms without an Internet connection. Wouldn't you run into the same issues (not being able to save due to lack of Internet connection) with your custom HTML buttons?

0 0
replied on February 27, 2014

Thanks Eric , the form is so long that to do each field would be a tedious task . 

 

The save function is to be used before loss of connectivity , not while it's lost .

 

thanks very much for your input I'm happy with current process and it would not have been possible without your advice on the article link I posted above

 

thanks again ! 

 

0 0
replied on February 28, 2014

You're welcome! I'm happy to help.

0 0

Replies

replied on February 27, 2014

I've done this through making the fields not required in the laserfiche forms controls then checking them programmatically through javascript with a "ready to submit" button.

 

When the user clicks "ready to submit" it checks missing fields and responds back with "missing data in xxx" inside a text box down where the submit button would be. If that text box is empty after hitting that button then I hide it and display the submit button.

 

You could also potentially change those field types to required as well. I didn't because my fields only needed to be required if certain choices were made. 

0 0
replied on February 27, 2014 Show version history

You could do this programmatically with JavaScript by disabling or hiding the submit button. This way, the code could check to see if the required fields have values and prevent the submit button from being clicked if they don't.

 

Here's some sample code for hiding the button based on an action, in this case the submit button is hidden until the user checks the "I agree" checkbox. This code targets the submit button using the .Submit class and targets a checkbox using a class I added to it (checkbox).

 

$(document).ready(function() {
    $('.checkbox').click(function () {
        if($('input[value="I_confirm"]').is(':checked'))
      {
        $('.Submit').show();
}
else
{
      $('.Submit').hide();
}
});
});

Or you could disable the button:

$(document).ready(function() {
  $('.Submit').attr("disabled","disabled")
    $('.checkbox').click(function () {
        if($('input[value="I_confirm"]').is(':checked'))
      {
        $('.Submit').removeAttr("disabled");
}
      else {
      $('.Submit').attr("disabled","disabled")
      }
});
});

 

0 0
replied on February 27, 2014

Had an Issue of the process modeler not following the correct path after save and then trying to submit because the save_Button value was still in the form from the previous form submission.

 

added this to clear the previous value in javascript and now working 100%

 

$(document).ready(function () {  
  $('.saveButton').click(function () {
    $('.submit_Field input').val("");
    $('.save_Field input').val("");
    $('.delete_Field input').val("");
    $('.save_Field input').val("Save");
  });
});
$(document).ready(function () {  
  $('.submitButton').click(function () {
    $('.submit_Field input').val("");
    $('.save_Field input').val("");
    $('.delete_Field input').val("");
    $('.submit_Field input').val("Submit");
  });
});
$(document).ready(function () {  
  $('.deleteButton').click(function () {
    $('.submit_Field input').val("");
    $('.save_Field input').val("");
    $('.delete_Field input').val("");
    $('.delete_Field input').val("Delete");
  });
});

 

0 0
replied on February 27, 2014

As a tip, you can actually stack your selectors in jQuery to clean up the code a bit:

 

$(document).ready(function () {
    $('.saveButton').click(function () {
        $('.submit_Field input, .save_Field input, .delete_Field input').val("");
        $('.save_Field input').val("Save");
    });

    $('.submitButton').click(function () {
        $('.submit_Field input, .save_Field input, .delete_Field input').val("");
        $('.submit_Field input').val("Submit");
    });

    $('.deleteButton').click(function () {
        $('.submit_Field input, .save_Field input, .delete_Field input').val("");
        $('.delete_Field input').val("Delete");
    });
});

 

2 0
replied on January 15, 2016

Hi there,

User Task save as draft feature is supported in Laserfiche Forms 10.

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

Sign in to reply to this post.