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

Question

Question

how to pull values from a form in a asp.net web application

asked on January 13, 2014

I plan to use Laserfiche forms in my web application. I have embedded the form on my page. How do i pull values entered in the form into my code behind?

 

0 0

Answer

APPROVED ANSWER
replied on January 13, 2014 Show version history

You can use a modified embed code for your form to allow the parent page and the embedded form to communicate (assuming both pages are within the same domain). See this page in the online help for more information.

 

Here's the example from that page:

 

<script type="text/javascript" src='FormsServerURL/Forms/js/forms-embed.js?v=9.1'></script>
<script type="text/javascript">
var title = document.getElementById('title').innerHTML;
var lf = new LaserficheForms.Form(document.getElementById('myform'), {
bpid: 'ID', host: 'FormsServerURL/Forms', params: 'Topic_Name='+ title,
onloadCallback: function () {
var s = lf.getFrmDocument().getElementsByName('action');
if (s.length > 0) {
s[0].onclick = function () {
document.getElementById('myform').style.display = 'none';
};
}
}
});
</script>

 

You can specify field variables and their values using params, and you can use this onloadCallback function to interact with the form after it has loaded. In the above example, after the form loads, the script finds the action button and sets the iframe's display to "none" on the parent page when the action button is clicked.

2 0
replied on January 13, 2014

Ok, let me try. How do you retreive the value of the form variables. What event gets fired when you hit the submit button in the form?

0 0
replied on January 13, 2014 Show version history

After the frame for the form page loads the event "onloadcallback" gets triggered. In our example code above what we create is a callback on submit button so when they click submit 'document.getElementById('myform').style.display = 'none';' gets run. Just run your code instead in that callback and you should access to form as well as your page elements. Just note the lf.getFrmDocument() is how you get the element on the forms page while document element is your page.

1 0
replied on January 13, 2014

Ok, let me try. Thanks.

0 0
replied on January 13, 2014

I have an alert statement inside the onloadcallback. It is not getting fired. What should be the value for "After submitting the form" in the business process that has the form?

0 0
replied on January 13, 2014

Is it possible for you to send me a simple example please of the parent page? It always shows the thank you form for me. Thanks.

0 0
replied on January 14, 2014

I am not able to get onloadcallback to trigger. This is my code. Can you please point out if i am doing anything wrong?

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled Page</title>
</head>
<body>
<script type="text/javascript" src='http://v-dev-w7x64-26/Forms/js/forms-embed.js?v=9.1'></script><script type="text/javascript">lfembed = new LaserficheForms.Form(null /*element to place form in*/,{bpid: 'id', host:'http://v-dev-w7x64-26/Forms/js/forms-embed.js?v=9.1/Forms',
onloadCallback: function() {
    alert('hi');
}
}).getFrm();</script>
</body>
</html>

 

 

0 0
replied on January 14, 2014

onloadCallback is not getting fired when i hit the submit on the form. It always goes to thank you page

0 0
replied on January 16, 2014

Can anyone please respond as to why onloadCallback is not getting fired when the form page loads? Thanks

0 0
replied on January 16, 2014

You'll need to specify the appropriate business process ID and the Forms Server URL in your code. You can find these values on the Publish page for your process in the default embed code.

0 0
replied on January 16, 2014

I did that. Is this a feature in Forms version 9.1?. Also, I want to call a javascript function when user hits submit. The javascript will call a server side function in asp.net. How do I do this? 

0 0
replied on January 17, 2014

The modified embed code is new to Forms 9.1.
 

0 0

Replies

replied on January 13, 2014

Can you try to explain a little bit more? 

 

You are working on an ASP.NET web app that will have a form integrated into it?

 

Are you unable to use a webhook to transfer data? 

1 0
replied on May 26, 2021

What data is sent in the request body of the 'webhook' activity in Forms?

I would have assumed the the form "dataset" would be included.

Can you post an example of the schema with mock data?
 

0 0
replied on January 13, 2014

Yes. I have a asp.net application and trying to use laserfiche forms for the front end for some pages. When the user hits Submit, I have to access the database and access the message queue. Also, after that, i need to redirect the user to another form. i have not tried webhook. Is that the best way? Thanks a lot for prompt response.

0 0
replied on January 13, 2014

I am confused about having to route the user to another form, that's a built in Forms functionality. 

 

Since you are using ASP.NET for a web app, you may want to make it reference-capable and have the webhook point to the webapp. This is likely the easiest way to transfer the information you desire without having to query the DB's or create a custom bit of code that will grab the form submission before LF Forms does. 

 

This would also ensure that moving forward, you do not have any incompatibilities as you are using built in LF Forms functionality to accomplish a task.

0 0
replied on January 13, 2014

Ok. Do you have any examples? Also how do i call third party api's in this approach once the user hits submit? 

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

Sign in to reply to this post.