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

Question

Question

LF Forms: JavaScript Altered Forms

asked on March 5, 2018

SITUATION

I have a form with status indicators that get updated via JavaScript as each step is validated as complete.

 

ISSUE

When I  save the form to the LF repository, these color states are not maintained, although the selections within the steps are.

 

NEED

Is there a way to may maintain the color status of these steps in the saved file (PDF or TIF)?

 

ATTACHED EXAMPLES

  1. Form-Before-Completed
  2. Form-After-Completed
  3. Form-As-Saved
Form-Before-Completed.PNG
Form-After-Completed.PNG
Form-As-Saved.PNG
0 0

Replies

replied on March 5, 2018

You use CSS to format the circles and they will be saved with the form.

Here is a simple format for 4 Green Buttons

.AButton, .BButton,.CButton,.DButton{
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
 
  border-radius: 15px;
  box-shadow: 0 9px #999;
}
.button:hover {background-color: #3e8e41}
.button:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);}
.button1 {border-radius: 2px;}
.button2 {border-radius: 4px;}
.button3 {border-radius: 8px;}
.button4 {border-radius: 12px;}
.button5 {border-radius: 50%;}
0 0
replied on March 6, 2018 Show version history

David,

Thank you for the reply.

So while I am using CSS and the UI is functioning as expected, and I can make colored buttons (see the KEY in my examples above), what I am not able to figure out, is how to get the changed state of the button to appear in the Save-to-Repository version of the form.

Now I do see that you create a CLASS in CSS for each button (.AButton, .BButton,.CButton,.DButton) which I do not do.  Instead I use a single CLASS (.step) for all buttons and use the element's "ID" as a reference, ID="#qn" for example.

Is that the key difference?

[NOTE: I will try using your idea of assigning multiple CLASS IDs to the same properties.  For example .step1, .step2 ... and see if that solves it. I will post the resolution.]

MY current CSS and sample JS logic are:

CSS

/* Step Button */
.step {
  background: #cccccc;
  border-radius: 0.8em;
  -moz-border-radius: 0.8em;
  -webkit-border-radius: 0.8em;
  color: #ffffff;
  display: inline-block;
  font-weight: bold;
  line-height: 1.6em;
  margin-right: 5px;
  text-align: center;
  width: 1.6em; 
}

JS

//STEP 1 Complete?
if ( $('#q11 select option:selected').text() != "" &&
     $('#q13 input').val() != "" ) {
         $('#q6 .step').css("background","#008000");

0 0
replied on March 6, 2018 Show version history

The changes as I described, using multiple CLASSES (.step1 ... .step9) did not resolve the issue.  As you can see in the Form-As-Saved-2 screenshot, if the button is hard-coded (as is the case for the KEY), it is retained.  If the button color is dynamically changed, it will reflect in the UI in the LIVE session, but not be captured in the stored document.

 

HERE'S WHAT'S ODD

All the buttons use the same base CSS, from the KEY (class="key") to the STEP (class="step1") . Yet the KEY buttons can be recolored and those colors are reflected in the Saved-As document, while the STEP buttons are not.

 

NEXT TEST

I specify the ID for the keys, and do not for the steps. I will test this to see if it makes a difference.

 

CSS

/* Step Button */
.step1, .step2, .step3, .step4, .step5, .step6, .step7, .step8, .step9, .key {

...

JS

  // SET KEY COLORS
  $('#q86 span[id="i1"].key').css("background","#cccccc")    // GREY
  $('#q86 span[id="i2"].key').css("background","#008000")    // GREEN
  $('#q86 span[id="i3"].key').css("background","#b40101")    // RED
  $('#q86 span[id="i4"].key').css("background","#004c98")    // BLUE

 

//STEP 1 Complete?
   if ( $('#q11 select option:selected').text() != "" &&
        $('#q13 input').val() != "" ) {
           $('#q6 .step1').css("background","#008000");
}

 

Form-As-Saved-2.PNG
0 0
replied on March 6, 2018 Show version history

RESULT FROM TEST

This does not resolve the issue. 

 

The form SECTION title code is:

<span class="step1" id="step1">1</span> Zoning Review -- Application Tracking

 

The underlying JavaScript code to change the STEP button is:

//STEP 1 Complete?
    if ( $('#q11 select option:selected').text() != "" &&
         $('#q13 input').val() != "" ) {
            $('#q6 span[id="step1"].step1').css("background","#008000");
    }

 

0 0
replied on March 6, 2018

I save the form with current process data and as a PDF. Check this setting,

0 0
replied on March 6, 2018 Show version history

Tried those, no success.

I don't think I mentioned this, but I am on LF Forms 9.2.1.

 

We have 10.2 running and I plan to try it on that once I have the workflow imported.

 

I see in LF Forms 10.2 that there are the additional option you addressed. I am looking forward to trying these soon.

0 0
replied on March 6, 2018

Ok I started this project with Buttons in 10.2 so I am unable to comment on 9.2.1

I used HTML custom field on the form to create the Buttons, CSS to format them and JScript to input result of Button pressing in an input field on the form. I presume that  LF programmers use "what you see is what you get" on form to snapshot the screen to create the pdf before save in 10.2

0 0
replied on March 6, 2018

David ,

I think I am getting closer now with 10.2 -- need to verify if the docs in the repository are what I expect.  However, for the rest of the challenge:

  1. The HTML-blocksIn-line HTMLCSS and JS code areas = OK
  2. WYSIWYG display functionality = OK
  3. Business Process flow and Workflow processing = OK

 

Once I can validate the repo, I think I am golden on this, I thank you for engaging and being engaged.

0 0
replied on March 6, 2018

Great I am happy that I could contribute. I learnt a lot too. Cheers

0 0
replied on March 8, 2018

David,

 

I had a chance to review the repo docs today -- and the settings, as I understand what you describe, did not give me the result I am looking for -- any thoughts?

 

Here is how the step is configured.

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

Sign in to reply to this post.