Home › Forum › Objects Reference › script call from code behind
This topic contains 3 replies, has 2 voices, and was last updated by ijobling 7 years, 8 months ago.
- AuthorPosts
- August 31, 2009 at 9:52 am #293
AnonymousHi,
I tried to embed the forms to my .net site.
Basically I want the form script to depend on the button click.
I registered your utils.js on top of the aspx page.
Then on my aspx page, I added:
<asp:updatepanel runat=”server” id=”updatepanel” >
<contenttemplate>
<asp:button runat=”server” id=”button”></asp:button>
<asp:literal runat=”server” id=”formliteral”></asp:literal>
</contenttemplate>
</asp:updatepanel>
code-behind:
Public Sub button_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button.click
Dim script As String = ” <script type=””text/javascript””>pf_embed(“//app.perfectforms.com/player.swf?3.2.0.4”, “”flexApplicationLTIxNDc0NjYwNjc=””, “”f=tFRgAgWE””, “”654″”, “”470″”, “”window””); </script>”
ScriptManager.RegisterClientScriptBlock(formliteral, formliteral.GetType(), script,False)
formliteral.text= script
End Sub
The form doesn’t show up when the button is clicked – although no JS error shown. Do you know how to fix this?
The idea is that I want to replace the button with dropdownlist, and show the correct form when a form is selected.
Thanks,
Andreas
September 1, 2009 at 9:52 am #4748slightly confused to be honest to your intentions here.
You would look to embed a form when you wanted that form to present to the users as they visted your page.
Where here it seems you want to have a button (or drop down later) that users click/select and then that is to present them a form, then embedding doesn’t come into this, nor the util.js
All you should need under your ‘button’ is the link to the actual form and that then opens the form for them.
No reason though why you couldn’t set up a number of pages in your website and embed each of the forms to these pages and then your button/drop down is simply sending them to that webpage for them to see the form
September 2, 2009 at 12:49 am #4750
AnonymousSorry if it was not that clear.
My intention is that I don’t want to create plenty of pages as I got more than 10 forms. It also reduces the interactivity of users because it will cause a postback when navigating to other page. Iframe is not a good solution either.
But not to worry. I have found a cause of the problem and established a workaround. It turns out that document.write caused this problem. So I just output the <object> tag straight away to the page depending on parameters I put in the code behind.
It raises another question though:
1. The ExternalCall function can be used to populate form values correct? I can’t see how to do this (the documentation is not clear and there is no sample). Can you please show me a sample?
2. I can perform some code after submit button is clicked (such as printing/emailing pdf, writing to database) correct?
The idea is that I want users to be able to complete incomplete forms, and track all the forms they had deal with. (these are public users, not perfectforms users – therefore I have to integrate it with my application)
Does it give us those flexibility?
Thanks,
Andreas
September 2, 2009 at 7:49 am #4751have a look to the user guide where the interactive example forms are also available
/Documentation/manual/html/fl_sample_forms.htm
the ‘Passing Data to Forms by Querystring Example’ show show you can populate form fields (it isn’t the ExternalCall function you have seen – this explanation, and a few others are still being worked on for an update to the user guide)
and also there is ‘Allowing a Form User to Save Then Submit Later’ to show how you can have users saving and completing later.
in respect of ‘code after submit’ … yes, but not in that exact manner. any ‘form’ actions (initiate a print, write to a database etc) are best handled before the actual ‘submit’, and then use the workflow functions to handle the notification to your users (as you look at the ‘save and return’ form example you will see how the notifications are best handled, as well as in the user guide in regard to how to implement workflow
/Documentation/manual/html/workflow_intro.htm
ps to intergrate to other databases you will need the Connection Agent modules. Talk to your account representative for more information on this
- AuthorPosts
You must be logged in to reply to this topic.