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

Question

Question

Assigning Variables for Laserfiche Forms from a URL

asked on July 28, 2017

How do you assign variables in a laserfiche form with spaces instead of "+"s. Using a URL in Salesforce to launch forma and assign variables.

Pulling in contact names means random "+"s are auto-filled instead of a space. Also we are having issues assigning these variables at the beginning, which then are used on a continuation of the form. (Right now they only seem to be assigned if the variable/field is used on the very first form/screen.

 

Thank you all!

0 0

Answer

SELECTED ANSWER
replied on July 28, 2017 Show version history

I have no idea on that one unfortunately.

Substitute wouldn't work anyway as there is a bug in the current version of forms that causes functions to wipes out white spaces.

Looks like the easiest option is going to be JavaScript. The following code will replace any "+" with a space when the form first loads.

$(document).ready(function(){
    $('input[type="text"]').each(function(index,value){
        $(value).val($(value).val().split('+').join(' ')).change();
    });
});

NOTE: You will need to adjust this slightly if you ever need to include multi-line fields, and other field types could prove trickier.

1 0

Replies

replied on July 28, 2017 Show version history

I've never seen "+" replace spaces like that before. Can you show us an example URL created by Salesforce?

As for the variables, the URL parameters populate the fields on the form, so if the field isn't on the form I don't think it will store the value.

If you have fields that are only used on later forms, you can add them to the starting form and put them all in one Section, then set it to Hide > Always and "Save the Data"

Then you can populate it with the URL.

0 0
replied on July 28, 2017

Awesome! Thank you for the help with the variables! (setting up the change now)

Here is an example of the URL and the "+"s being added.

 

 

 

And the Button/Link itself - 

 

Thank you again!

- David

0 0
replied on July 28, 2017

Although I definitely understand the variable thing, it still does not work. I assign the variables with URL to a variable and section that are defaulted to hidden, but still save the values.

 

Any thoughts?

0 0
replied on July 28, 2017

As far as the "+" where spaces should be, my best guess is that the functions are putting something in the URL that Forms is interpreting as the "+" character. What do the values actually look like in the address bar (the actual URL it is creating).

For the variables, check a couple things:

  1. Verify that the variables are Form 1 are actually the same variables you have on Form 2, Form 3, etc. (i.e., did you drag them on from the variables tab, or did you create new ones?)
  2. Turn off the hiding rule and make sure they are actually getting populated.
1 0
replied on July 28, 2017

The fields themselves are spaces, and when referenced in the URL, there are "+"  signs.

I have un-hidden them, and they are not showing up... which is also really odd... I guess I will have to keep playing around with that then. (They are the same variable in the different forms... good question though)

0 0
replied on July 28, 2017

The URL for the form where the variables aren't assigning does include the correct information, it is just on the form itself it is not showing up! :/

0 0
replied on July 28, 2017

Got it!!! lol... I had them as read only... whoops.

Okay... so these plus signs... any ideas as to how to get rid of them?

0 0
replied on July 28, 2017

The URL should have a "%20" for spaces, not "+", so it sounds like you'll need to address that where it builds the URL.

If you're seeing the + sign in the actual URL in the address bar, then the functions in the custom button/link builder might be injecting the + for some reason.

Since it uses functions, you could try adding a Substitute function wrapped around the variable retrieval that replaces " " or "+" with "%20" and see what happens.

The URL parameter should look like more like "?varLastName=Doe%20(Test)"

0 0
replied on July 28, 2017

Was already working on a similar fix, only using SUBSTITUTE in laserfiche forms...

With forms however, it was blank, and with the URL, this happened...

 

 

0 0
replied on July 28, 2017

I just tried having two field... one that gets assigned with the url on the first page, and then another field/variable on the next form/page that had the SUBSTITUTE formula using the first field... and that didn't work either. :/

 

Again... thank you so much for you help. It is SO nice to talk to someone who really knows their stuff!

0 0
replied on July 28, 2017

Turns out the character "+" is becoming the standard for a space instead of %20... do you happen to know if this is something that will be updated in the future?

0 0
SELECTED ANSWER
replied on July 28, 2017 Show version history

I have no idea on that one unfortunately.

Substitute wouldn't work anyway as there is a bug in the current version of forms that causes functions to wipes out white spaces.

Looks like the easiest option is going to be JavaScript. The following code will replace any "+" with a space when the form first loads.

$(document).ready(function(){
    $('input[type="text"]').each(function(index,value){
        $(value).val($(value).val().split('+').join(' ')).change();
    });
});

NOTE: You will need to adjust this slightly if you ever need to include multi-line fields, and other field types could prove trickier.

1 0
replied on July 28, 2017

Yeah... I think there may definitely be instances where this will not work... but for now, I say it works pretty slick!! Thank you so much!

0 0
replied on July 28, 2017

Yea, you'd need to get a bit fancy with Drop-down fields, radio buttons, etc., but it should still be do-able even if that comes up (the trick in those case would be dropping the values into single line or multi line fields to strip the "+" and then using that value to update the other field).

0 0
replied on July 28, 2017

I think I gotcha... I won't worry about it too much until I get there. Still have two years of school left, so I don't know java script yet (but I will... I do know C++ and Java).

 

Again, thank you for all of the help!

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

Sign in to reply to this post.