Clear all the fields in infopath on click of a button - infopath

I have an infopath 2010 form with around 100 controls and i have a requirement to clear all the fields on click of reset button. I have the following options:
Clear all the fields on by one (Very Tedious process)
Close the forms and open a new form
I am not allowed to write code. Any help in implementing option 2 above is appreciated.
Note: I will be deploying these forms as browser enabled forms to a sharepoint form library.

If you use a Filler form, you can try the "Blankem" technique outlined in this post on Infopathdev.com. It involves editing the source files and won't work in a browser form.
http://www.infopathdev.com/forums/t/23486.aspx
There is a sample file attached to Patrick Halstead's first post after the question.
A video with a walk-through is here: http://www.youtube.com/watch?v=9rtXm5oOEhI&feature=plcp
The rule that is used cannot be applied to a browser form, since the Blankem technique involves using a Set Value destination XPath that is not a simple node path, and not something that the InfoPath designer would let you select. While InfoPath filler will allow you to still use the form under these conditions, SharePoint will not allow it. (source: comment from Jimmy Rishe at another thread at Infopathdev.com)
If you are using a browser form, you will need to clear the fields with individual actions in a rule.

try to copy full shema to string (while it is clear) and then in button event replace shema
http://www.bizsupportonline.net/blog/2009/08/clear-reset-fields-infopath-3-lines-code/
it may help you

Related

Sitecore - Webforms for Marketers 2.3 - Inserting a new form into a page

I'm trying to insert a new form I created in Webforms for Marketers 2.3. I go to the page I want to insert the form on, presentation tab, form, Insert. I select the form I created but then get a message - "There are no allowed placeholders in order to insert a new form".
I then went to Layout-Placeholder Settings-Content and added Layout-Renderings-Modules-Webforms for Marketeres - Form.
No success.
I've also tried adding the form while it was and was not in the Webforms for Marketers restricting placeholders settings.
No success.
So, anyone know what I'm missing? Do I need to add a specific sitecore placeholder in the sublayout to hold the form?
To expand upon Zach's answer.
I had not been binding the placeholder settings to the page correctly. To do this I went to the Presentation tab and hit details.
I then went to the placeholder settings, and added a new entry here.
Make sure to enter the correct place holder where the form will be entered. Then go and add the form on the page. Once you choose your form and have added the placeholder correctly, it should show up here. (This was my original problem).
You need to set up which placeholders a form may be added to using the Restricted Placeholders window accessible from the Sitecore Desktop.
Steps
First, open the sitecore desktop and go to All Applications -> Web Forms for Marketers -> Restricting Placeholders:
Next, use the resulting window to configure the placeholders to which forms may be added. At least one of the selected placeholders must be present for you to add a form to the item.
I hope this helps. Good luck! :)
There is another edge case where this dialog may fail to display your available WFFM placeholders.
If you have the SSL Redirector module installed, and the form page in HTTPS mode, the dialog will fail to display the list of placeholders.
The solution is to modify the SSL Redirector to only perform redirection when Context.PageMode.IsNormal is true, and the current site name != "shell".

A big dilemma - ASP.NET and jQuery

I have a wizard style interface where I need to collect data from users. I've been asked by my managers that the information is to be collected in a step by step type process.
I've decided to have a page.aspx with each step of the process as a separate user control. step1.ascx step2.ascx etc...
The way it works now, is that when the initial GET request comes in, I render the entire page (which sits inside of a master page) and step1.ascx. When then next POST request comes in for step 2 (using query string step=2), I render only step2.ascx to the browser by overriding the Render(HtmlTextWriter) method and use jQuery html() method to replace the contents of a div.
The problem with this whole approach, besides being hacky (in my opinion) is that it's impossible to update viewstate as this is usually handled server side.
My workaround is to store the contents of step1.ascx into temporary session storage so if the user decides to click the Back button to go back one step, I can spit out the values that were stored for it previously.
I feel I'm putting on my techy hat on here in wanting to try the latest Javascript craze as jQuery with .NET has taken a lot of hack like approaches and reverse engineering to get right. Would it be easier to simply use an updatepanel and be done with it or is there a site with a comprehensive resource of using jQuery to do everything in ASP.NET?
Thanks for taking the time to read this.
Another approach, that might be easier to work with, is to load the entire form with the initial GET request, and then hide all sections except the first one. You then use jQuery to hide and show different parts of the form, and when the final section is shown the entire form is posted in one POST to the server. That way you can handle the input on the server just as if the data entry was done in one step by the user, and still get the step-by-step expreience on the client side.
You could just place all your user controls one after another and turn on the visibility of the current step's control and turn on other controls when appropriate . No need to mess with overriding Render(). This way the user controls' viewstate will be managed by the server. and you can focus on any step validation logic.
Using an UpdatePanel to contain the steps would give the ajax experience and still be able to provide validation on each step. If you are OK with validating multiple steps at once, Tomas Lycken's suggestion (hide/show with JQuery), would give a fast step by step experience.
Did you look into using the ASP.NET Wizard control? It's a bit of a challenge to customize the UI, but otherwise it's worked well for me in similar scenarios.

ASP.NET page validation

I have a requirement wherein I have a bunch of about 10 aspx pages.The user shall be able to go from one screen to another using navigation.All the range , custom,regex validators need to file so that data enetered is correct.Required fields need not be entered at this stage and the user can skip required fields. On the last page, I need to find out all the fields which are required and if incomplete want to show the user, these fields are required, sort of summary with link to the page where the control was left blank.
Does any one have any good ideas to achive validation on pages which the user has left and can do validation at the very end before the data is submitted. Any pointers would be greatly appreciated.
Validators form part of the page on which they lie. You cannot use the built-in validator controls to validate input fields on previous pages in the sequence. If you must do it this way, then you should implement your own validation framework which validates data on each page, but provides feedback on the summary page.
You should look into the usability issues faced if you only give feedback to the user at the end of the sequence of pages. He/she will be required to go back a few pages and retry input there. I don't think that is a good option at all.
A much better option would be to use the ASP.NET Wizard control (which loads sequential UI in separate panels, but on the same page). That would enable you to use Validators in conjunction with your setup. This article by Steve C. Orr provides a good introduction to using Validators with the Wizard control.
Alternatively, you can use the AJAX Tab control as others have suggested.
You can achieve this by using i.e. a TabControl (ships with the Ajax Control Toolkit).
Same thing I am applying in Asp.net MVC but I suggest you to use Tab control rather to use Bunch of pages as sshow posted.

Add a new item to html-select list without leaving the page. How?

I've always wondered what is the best way to add a new item to html-select in a website.
Yes, this may sound silly but it is a great problem from the usability perspective. I don't want the user to be taken to a new page every time they need to add new item to a html-select.
I like the way Google Reader and Gmail handle this problem in there "add folder" and "add label" functionality. I would like to mimic that but i have no clue how they did that.
I'm using jQuery, so any reference to plugins, code examples or tutorials are welcome.
I would like it to be as modular as possible so i can reuse it anywhere.
I'm using ASP.NET 3.5 web-forms, Microsoft Access 2003, jQuery, IIS 5 and Win XP Professional as web server.
Thanks.
there's a jquery select plugin that might help you with this. I've manipulated select lists client side and had no problem with subsequent form-submits but you'd need to do some experiments w asp.net
The standard technique of doing this is called ajax, which basically means replacing only parts of the page. JQuery ajax and maybe a tutorial should get you going.
A common mistake for this scenario is to add the item on client (using jQuery or plain javascript). It may look that it works until the next post-back. Unfortunately the Asp.NET post-back model does not allow to alter the controls contents on client side only. So basicaly there are two choices:
Use ajax (the simplest would be to
use an UpdatePanel)
Make a normal
postback to add the item (simple and
fast to code, if performance is not
an issue - for intranet applications
for example)

Facebook Wall functionality using ASP.Net

I want to create something similiar to a facebook wall on my social site. I want to store the posts in an sql database and that should be rather simple. What I am looking for is a good way to display the posts? I guess I don't even really know where to start, as I can only think of using a loop to display asp:textboxes. Which obviously is not correct.
I want there to be multiple posts displayed on the page, which should include:
the user who posted,
the text posted,
the date posted,
and if I want to get crazy...a means of deleting/editing the post.
I really have no idea of how to implement this concept, so any ideas would help greatly.
To get started, view this article from asp.net on the Repeater control, or this great article.
The Repeater control lets you databind to a list of objects, and then define one template for how that object should be displayed. Then, ASP.NET will handle showing it as many times as necessary. You can write the code-behind for dealing with delete and edit as if there were only one instance on the page.
go ahead with jquery, use a lot of ajax. for the mark up, use a repeater control with all clean html mark up (instead of server side controls which would generate a lot of unnecessary mark up quickly creating performance issues)
only populate x number of items on initial load, and then using jquery pull data as required based on user action. you can serve this data via json, decode json on client side using jquery and perform a loop which converts this json into appropriate html and injects it into the correct html element
should be simple ;-)
ASP.NET gives you lots of ways to do this. A Repeater, DataGrid, GridView are the first that come to mind. If you'd rather use ASP.NET MVC, there's always the good old foreach loop.
Additionally, check out ListView too.

Resources