I'm having some issues with getting a form to display the correct fields when it's sent into Laserfiche, so I'm hoping someone can help point out my errors!
I have a process with 2 forms. The first allows the user to select which fields (Custom HTML) should be shown and which should be hidden on the final form. When submitted, a reviewer receives the second form, which gets the selections from the first form and displays the fields that were selected for inclusion. The form for the reviewer displays correctly . The same form is then sent into Laserfiche when the reviewer hits the Submit button. However, when it gets into Laserfiche, it either shows too many fields or not any.
I've tried all kinds of javascript/jquery manipulations, but only one seems to work, and it won't give me the results I need.
If I use the code below and select the option for the "X-1" field, the field with the "x1lta" class should be shown. The works fine in the reviewer's form, but not when it's stored in Laserfiche:
$(document).ready( function(){
$('.x1lta').hide();
$('.x2lta').hide();
$('.x3lta').hide();
$('.x4lta').hide();
if ( $('#q10 input').val() == "X-1" ) {
$('.x1lta').show();
}
});
If I remove the *.hide()'s at the beginning and put the last three in the "if" statement, all of the fields are displayed on the form in Laserfiche, but only the x1lta field is displayed on the reviewer's view of the form (which is correct).
If I move the $('.x1lta').show(); out of the if statement and put it below all the hides, the correct behavior happens and the stored document only shows the x1lta field. (I did that just for testing purposes.) So it seems like the hide and show methods work properly. The problem seems to be with the "if" statement. I know the code inside executes because I've used "alert" to let me know when it got inside the "if". I've tried putting a delay after the "if" statement, thinking that the code in the "if" statement doesn't execute before the document is sent to Laserfiche.
I need to be able to determine if each field was selected to be on the document and send only those fields into Laserfiche.
I've read a lot of questions/answers in this forum about the issues with showing and hiding fields (Custom HTML, to be more specific), and it seems that this can be a bit tricky. I've tried using the jQuery, css method to set the display of each field, and I got the exact same results.
Any ideas?