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

Discussion

Discussion

Passing Form Information

posted on July 22, 2014

How would I pass information such as a name or phone number to another webpage outside of the form that could then use that information.  

0 0
replied on July 22, 2014

Basically I need to do the following, which I am unsure of at the moment.

  1. Use js to select the dropdown fields value that is selected.
  2. Store that value into a variable.
  3. Pass that value to an html file.
  4. Use that information in js in that html file.
0 0
replied on July 22, 2014

Lets assume the dropdown is q1, The link has an ID="ChangeMe"

 

$(function() {
   function ChangeHTML () {
      var temp = $('#Field1').val(); // This handles both 1 and 2
      $(document).getElementById('ChangeMe').href = (http://placebaseURLhere" + temp); // This is part 3 and 4
   }

   $(document).on('change', '#Field1', ChangeHTML);
});

Might need some modification, but that should really be most of what you need

 

0 0
replied on July 22, 2014

So if the id is q32 I would use #Field32 ?

 

What is exactly happening on lines 4 and 7? I'm not totally following it yet.

 

0 0
replied on July 22, 2014 Show version history

Yes, if q32, then use #Field32 instead of #Field1

 

Line 4 changes the value of that link to have a new URL based upon the original URL and the value of the field. You will need to add the beginning pieces for defining the variable, should look something like &VARIABLE1=   that's the last part you should have before adding in the variable itself. that will make a complete URL for you to click on and have the information automatically inside the field you defined.

 

Line 7 is to cause Laserfiche Forms to make the change to the URL every time the dropdown field changes. So if you change the value, the function gets called and updates the URL properly

0 0
replied on July 22, 2014

Makes sense, so what do you mean its changing a link? I have it set to simply redirect when the submit button is clicked.

0 0
replied on July 22, 2014

Hmm...I have not played with changing where the submit routes to. I do not think that is something on the same page, so it may be impossible to change on a per instance basis. In my example, you need a Custom HTML field that has the link to the next thing you need done, that will be what changes when the dropdown changes

0 0
replied on July 22, 2014

Yeah, I have it set up to redirect to an html file once the submit button is clicked. I was just curious if you could transfer any information from the form to an external file. Would it be possible for js to write a variable to a text file and then read that text file inside js in the external html file?

0 0
replied on July 22, 2014 Show version history

I don't see any way to modify the submit button to do that. I do not see how you would accomplish this without knowing way more about JS and other web based things. If you point the URL to the HTML page, and change the html to have the variable, that's the only easy way of passing the information

0 0
replied on July 22, 2014

Right underneath the place where you can send an email and use variables in it, there is a redirect option.

0 0
replied on July 22, 2014

No, I understand that, but that redirect happens at the server level, meaning it's not something Javascript can modify the page to achieve what you are asking. My solution is the quickest and easiest to employ without ASPX knowledge or the use of Workflow or something way more complicated.

0 0
replied on July 22, 2014

Okay, I guess I'm confused what your way does. What is the link that 'changeme' refers to?

0 0
replied on July 22, 2014 Show version history

Ken is describing a way to pass information to a page using what's commonly referred to as "query strings", which are parameters that are embedded into a URL. You can read more about them here.

 

In your case, you can use Ken's method to dynamically create a link on the form that goes to your html file, except it would have query strings appended to the URL. You might then be able to use JavaScript on that page to parse the query strings.

 

Note that I haven't tested this personally, as it seems like a very fragile and non-standard way of doing things. In my opinion you're much better off writing a web service and sending the LF Form data there, and have it generate the view (i.e. the HTML file you're talking about).

0 0
replied on July 22, 2014

Sorry, I also think I am confused. I was under the impression you had limited technical skills and had said already that you are not capable of making a web service.

 

The solution I mentioned, is stable, assuming Javascript is enabled on the browser. It just isn't a completely fore=ced experience. It requires the addition of a Custom HTML field with a <a id="ChangeMe" href="..."> tag in it to get things done. 

 

I do not see how Ege's solution though solves the problem, how is he calling the web service and causing the user to instantly be redirected to the next page? Maybe he might instead use Javascript in the Message section to cause code to run that redirects based on the variables.

0 0
replied on July 22, 2014

Ege, nice profile pic :) 

I think this is becoming a bit more complicated than I had expected. I was seeing if there was a quick swift way to do it but it appears not. This isnt something I have alot of time to spend on. So I might just have to ask the user the same question twice, which isn't that big of a deal. One last question though, would it be possible to invoke a workflow after the submit button is clicked that would store the information into something like a text file and then read that information in the html file with js or something along those lines?

0 0
replied on July 22, 2014

You could, but workflow wouldn't be able to act fast enough if the user is immediately going to that page after clicking submit. Also, you would at minimum need to pass some value or have some type of way of figuring out what text file to use, in case two people are using this system at the same time, you will need 2 text files. more people, more text files.

 

If this is a form they are going to after the first form, then maybe using a database and the built in tokens could help if you cannot already have it as part of the same forms business process.

0 0
replied on July 22, 2014

So there's no way to write a custom click function for the submit button?

0 0
replied on July 22, 2014

You should be able to circumvent the default submit button and recreate it with added functionality. I have not tried it myself, but as long as you recreate what the stock button does, everything should still work. Keep me posted if you figure things out for this. You will still need to generate a link like I mentioned, but instead you use it as part of the new Submit button you create. You will want to make the submit cause the submit action on the form, but also open the link on a new window/tab. That will basically be what you are asking for, correct?

0 0
replied on July 22, 2014

I will need it to open in the same window/tab, I actually was trying to figure out how to disable going back/refreshing and I could only figure out how to disable f5 refresh. ANYWAY, how would I target the submit button to generate the new url, close the form, then redirect to the generated url?

0 0
replied on July 22, 2014

I was also looking into somehow running some js before the form closes. So instead of the redirect option, it displays the thank you message with the close button. Then when they click the close button it would invoke the code inside the before unload function. And then There I would redirect to a generated url but I havent gotten it to work so I'm not sure if thats even possible.

 

0 0
replied on July 22, 2014

I think you should just take some time to find out how to add a 5 second delayed redirect. add that to your message when the submit button is pressed. See if you can get javascript to work inside that message area before the delay is done to modify the URL it redirects. That's what I would recommend.

0 0
replied on July 22, 2014

There's nowhere to edit the click function for the submit button. I tried changing it to the other option where it displays a thank you message and has a close button. I edited the button to redirect but there's no way to pull the information from the form to add to the url.

 

Right now I'm trying to use a workflow that uses a c# script to open the url with the value attached. I cant seem to get the value to be added to it.

 

It literally puts "RetrieveFieldValues_Age" into the url and thats what shows up.

0 0
replied on July 23, 2014

I fail to understand how workflow is going to play into this all of a sudden. But I guess the idea of using the message page did not work out. Keep me posted on what you do to get the functionality you are looking for. 

0 0
replied on August 22, 2014

Josh,

 

This may not help w/ your bigger task at hand but the reason your url is showing up with the literal "RetrieveFieldValues_Age" is because of how the variable is being set on line 20.

 

string age = "RetrieveFieldValues_Age"; 

 

This declares the value of age to be the literal string of whatever is between the " " instead of referencing the value of the variable named RetrieveFieldValues_Age.

 

What I assume you want is to retrieve the value of the Token, "Age", and append it to your url.

 

Try this:

 

Namespace WorkflowActivity.Scripting.Script
    '''<summary>
    '''Provides one or more methods that can be run when the workflow scripting activity is performed.
    '''</summary>
    Public Class Script1
        Inherits ScriptClass90
        '''<summary>
        '''This method is run when the activity is performed.
        '''</summary>
        Protected Overrides Sub Execute()

            Dim age as String
            age = GetTokenValue("Age")
            System.Diagnostics.Process.Start("http://test?"+age)
        End Sub
    End Class
End Namespace

 

Again, not sure this solves your larger issue but it will solve your url issue mentioned in your last comment.

 

Cheers,

Carl

0 0
replied on July 22, 2014

I will give that a try, but I was also considering using cookies to pass the information. Do you know anything about using js to write a cookie and then reading it?

0 0
replied on July 22, 2014

Sorry Josh. I know bugger all about code... sad

 

There is also the 'HTTP Web Request' node in WF which seems to have slightly more options. Have a try I guess and see what happens..... laugh

0 0
replied on July 22, 2014

I keep getting a bad request error... Have you used either of those http integrations to do this before? I would think it shouldnt be this complicated to simply pass a variable or specific info to a new webpage!!

0 0
replied on July 22, 2014

Some websites have minimum info that they require in order to process requests. Sometimes an MD5 hash or similar if you want to pass documents. You would need to check with whoever maintains the web page to find out what information and in what format it needs to be passed. (HTML, Text, XML etc)

0 0
replied on July 22, 2014

Well its not really an actual website, its a custom html file I'm trying to pass the information too. Then I use javascript functions based off that information. I would just completely redirect and not worry about that information except I need it saved in the database, which forms does when the form is closed. So the field is a dropdown list. I need to target this in order to get the value into a variable, then store it in a cookie. Once the form closes and redirects to the html file, I need to open the cookie file and retrieve the stored variable value. 

0 0
replied on July 22, 2014 Show version history

Well if you know anything about code you can insert custom HTML stuff inside a service task in forms. Maybe you could write it out that way?

Or I could be waaaaaaay off the mark here.

0 0
replied on July 22, 2014

I believe thats for sending an email because at the bottom of that page is the redirect option which is what I need. But you cant append anything to the url... which would make it waaayyyyy simpler.

0 0
replied on July 22, 2014

Hmmm. Not too sure then. Maybe Laserfiche can point us in the right direction here....

 

Good luck Josh! laughyes

0 0
replied on July 22, 2014

Yeah no kidding! Thanks for trying :)

0 0
replied on July 22, 2014

Hi Josh,

 

I'm not sure if this is possible from within LF Forms however you could have a workflow pass the information once it's in Laserfiche using the HTTP Form Post and selecting POST or PUT.

 

Hope this helps! yes

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

Sign in to reply to this post.