November Happy Hour will be moved to Thursday December 5th.

Ta hand om formulärdata från XForms

Vote:
 
Hej! Jag är intresserad av att använda XForms för att skapa interaktiva blanketter, men har stött på vissa problem. Problemen som diskuteras nedan gäller då formulärsdata sparas till databas. Problem 1: Det verkar som om vilken redaktör som helst kan ta del av inskickad formulärdata (fliken Formulärdata i edit-läge) så länge han har läsrättigheter till formulärssidan. Jag vill att endast ett begränsat antal användare skall kunna göra detta. Är det möjligt? Alternativ lösning: Bygga en egen portal för att hantera formlärdata. Vilket leder in på nästa fråga. Problem 2: Hur hanterar jag bäst formulärdata. Skriva Queries direkt mot databasen eller finns det några fina klasser att använda. Har kollat runt lite i SDK:t. Vore tacksam om någon kunde ge lite hänsvisningar vad jag bör kolla närmare på. Hade varit trevligt med ett litet exempel på hur man hämtar formulärsdata för ett formulär och lägger in det i en DataGrid. Problem 3: I vissa fall krävs mer utförlig validering. T.ex jämförelse mellan olika fält, eller kontroll mot en databas. Kan man skriva egna validatorer och göra dem tillgängliga i XFormulärsredigeraren? Hur? Alternativ lösning: Koda formulär som kräver sådan validering för hand. Ger dock ingen möjlighet för redaktören att själv skapa avancerade formulär. Hoppas det finns någon som kan ge mig lite klarhet i dimman :) M v h Linus
#12308
Jun 28, 2005 11:46
Vote:
 
Hello Linus! 1. Today it is not possible to set access rights for forms or form data. We have this on our "todo"-list as well as the option to structure of the forms on a site. 2. On the following page there are some examples of how you can work with forms and form data: http://www.episerver.com/templates/CommunitySample____4137.aspx 3. This can be done by working against the class EPiServer.XForms.DataTypes. The following code example shows how the built in data type integer is added: EPiServer.XForms.DataTypes.Types.Add("integer", @"^(-)?\d+$"); If you want the name language coded you can add these at the following section in a language file: /edit/editxform/datatypes/ Note that these are executed with regular expressions. Today, there are no ways to add datatypes that will appear in the editor and check these by code. You can, however, add special validation to your form. There are examples of how to do this in the page that was linked above. Regards Linus Ekström EPiServer Developer
#14030
Jun 30, 2005 16:58
Vote:
 

Thanks for that Linus.

Do you know whether it is possible to change the Regex for an existing XForms.DataTypes.Types element? I want to enhance the email address regex.

I'm sure I've seen some code that updates the existing types (done in the Global.asax.cs file?)

 

#23873
Sep 17, 2008 20:01
Vote:
 
Hello!  I'm very interested in the link above (...communitySample...) but it doesn’t work. Is there anyone that knows the correct address or can point me to a similar article?

 

#29988
May 26, 2009 11:45
Vote:
 

Hi!

Well, there is the following article that contains alot of useful information, although not really any code sampels.

http://world.episerver.com/en/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-5-R2-SP1/Developing-with-XForms/

I can't seem to find the old code samples, but if you share your particular problem perhaps we can find a solution.

As for Marks old question, it should be possible to replace the built in valiadtion. The DataTypes are stored in a static Hashtable, which you can modify directly. Guessing it would be something like this:

EPiServer.XForms.DataTypes.Types["email"] = "my new regex";

Regards

Per Gunsarfs
EPiServer CMS development team

#29996
May 26, 2009 16:08
Vote:
 

Hi!
I am also looking for code samples about xforms.
It seems almost impossible to find. The Developing-with-Xforms document is not helpful in this case!

 

#33769
Oct 20, 2009 9:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.