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

Question

Question

Forms - Only assign class to object while forms are in use, not save to repository

asked on September 5, 2019

I have a table with a class, that has styles which cause issues in the final save to repository image.

In 10.4.1 this option in Javascript no longer does anything. It is never true when saving the repo image.

//When creating archive image
  if ($('[name=IsLocked]').val() == 'True'){
//Remove class or whatever
}

That was my old trick to do this, but how do I just set a class on an object ONLY for the visual part of using the form, not the final archive?

I created a button where the user clicks the confirm button and it removes the class, but as usual this is not permanent and the system re-adds the class to the object before saving the image.

0 0

Replies

replied on September 6, 2019

Hi Chad,

The $('[name=IsLocked]').val() == 'True' still worked for me on 10.4.1.

How did you find it not working on your side?

0 0
replied on September 6, 2019 Show version history

Oh I am on 10.3.1 in this environment, thought it was 10.4.1. I will schedule another upgrade for this weekend. It certainly does not work here though. I can verify that I am doing it right by using the forms history (read-only view) which DOES abide by the clause.

$(document).ready(function() {    
if ($('[name=IsLocked]').val() == 'True'){
            $('.preEventTotals').removeClass('preEventTotals');
	}

I have this in my document ready function, which removes the class from the section.

The section is moved off the form and set static while the user is filling it out so that it is always on screen.

I can verify that the class is removed correctly using the IsLocked clause by looking at the submissions in the forms history where I see the section is back on the form, due to my code above

But the archive image in the repository and any PDFs sent in emails do not abide by it, they leave the class there and push the data off the screen.

 

I have also tried if(!document.title) or if(document.title == '') which I am surprised does not work, since I know the title is blank during creation of the final archive.

0 0
replied on September 8, 2019

I tried your custom js with the following css:

.preEventTotals { color: red; }

And it worked on form submission/file saved to repostiory.

So I guess the issue might be related with the css content, can you

  • Give me your css for preEventTotals, and
  • Try if custom js works using my css above?
0 0
replied on September 9, 2019 Show version history

Thanks for testing! I did try your CSS instead and experienced the same thing. I put an HTML element in the section so that I could see the text change color to red.

When viewing in the forms history, I could see that the text changed back to black, again indicating that this method is triggered when images are being created by Forms.

But the resulting archive TIFF and PDF contain red text still.

This was all on 10.4.1 when I tested today. I can give you my CSS but since we are simply removing the class, I don't think the actual CSS matters.

I am going to try jumping on a VAR webinar.

.preEventTotals {
  position: fixed;
  width: 300px;
  height: 100%;
  top: 21px;
  left: 1000px;
  background-color: rgba(255, 255, 255, .5) !important;
  overflow: auto;
}

 

0 0
replied on September 9, 2019

Jumped on the VAR webinar and Karina gave me another idea that is working really well.

        if (window.location.href.includes('Forms')){
		//Form is actively in use
	}

        if (window.location.href.includes('Forms') == false){
		//Form is being saved to repository
	}

 

0 0
replied on September 9, 2019

Yeah I was not able to reproduce with your CSS.

Glad to see it resolved.

0 0
replied on July 13, 2021

I could use a Javascript example of how to set a class specifically during the "Save to Repository".

0 0
replied on July 13, 2021

The above worked really well for me. However if your using 10.4.3+ they have switched to a new save to repository module. Not sure if this has changed anything, might just give it a try.

0 0
replied on July 13, 2021

Our Forms is 10.4.0.  I've been going in circles trying to get styles set via Javascript to be included in forms saved to the repository.

0 0
replied on July 13, 2021

I went down that crazy road once too. Always keep in mind that field values are not accessible in the save to repository image. So if you are including any conditionals which include any variables set by the value of a field on the form IE:

IF($('.myField input').val() == "hello world")
$('.myField').addClass('something')

This will not work because the field values are not accessible.

0 0
replied on July 13, 2021 Show version history

Yeah, my code isolates the divs that correspond to where the fields were in the form like this

    $( "div" ).each(function( i ) 
    {
      if(this.id.includes("Field117("))
      {
        var currRow = GetIndexFromElementID(this.id); 

        // Field119 is simply a single line (in a collection) that I save the class name to at runtime.
        this.className = this.className + " " + $('#Field119\\('+ currRow +'\\)').text();
      }
    });  
 

This works on the readOnly form display that happens when the form is first submitted, but does not for the actual SaveToResository.  I've tried your example of checking for the absence of "Forms" in the href on document.Ready, but it's still not working.  What am I doing wrong?

0 0
replied on July 13, 2021

This is the roadblock I ran into on every other post I made on the subject.

Without access to the DOM layer, how can you troubleshoot?

I went as far as creating a custom console by creating a div on the form and printing out to that, however I still needed to look at the DOM layer to see why the DIV I was looking for was not there or did not have the child object I was expecting.

0 0
replied on July 13, 2021

True, all of the PDF generation is done server side, no way to hook into it.  sad

0 0
replied on July 13, 2021

The new module is supposed to grab a screen image of the current state of the form on submission, so anything you build now might be wiped anyways.

I wonder how this new module works when you save a different form, one that the user did not see, and has different javascript, but contains shared fields.

0 0
replied on July 13, 2021

Good question, I would think it would have to load the form (as you mentioned) into a DOM with current business process variable values, but if it doesn't run any Javascript we're still in the same quandary.  But, yeah, grabbing a screen image would fix everything else.  Any idea when that is set to be released?

0 0
replied on July 13, 2021

It is already out, I bet it runs the javascript still, but the fields might be accessible now.

Just upgrade using the latest 10.4.3 package.

0 0
replied on July 14, 2021

Makes sense, upgrading Forms is already on my to-do list, so I'll be curious to see how this all works after that.  

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

Sign in to reply to this post.