Try our conversational search powered by Generative AI!

Controlling XForms

Vote:
 
We need to have control over some XForms. (1)We want to be able to fill some fields with user data before the user sees the form and (2)we need to be able to update the form data later on. (1)Is there some event (like BeforeSubmitPostedData) where I can set the value of XForm textboxes? So far I can create XForms, submit them and add new fields/values to the posted data, list posted data for all XForms, see data of one posting but not update that posting. Obviously I'm not the only one with questions about XForms - as it's a new feature - but I can say that 4.51 seems to have fixed some of it's problems. /Jonas Nordström, Init AB
#12401
Oct 19, 2005 8:59
Vote:
 
Hello Jonas! I just published a general sample user control that has the same functionality as the sample xforms user control. This one works directly against the xformcontrol instead of using the Property web control which makes life easier if you want to add events to the form. http://www.episerver.com/templates/CommunitySample____6043.aspx I also made an example that loads data from a current form data object when loading a form. For this to work you will have to add the following lines of code to the Page_Init event in the user control: if(!IsPostBack) FormControl.ControlsCreated += new EventHandler(FormControl_ControlsCreated); You also have to add the event handler where you load your form data: public void FormControl_ControlsCreated(object sender, EventArgs e) { String formDataId = "0e253f4e-b444-4854-a35b-f6a543edf9c0"; XFormData userPost = XFormData.CreateInstance(new Guid(formDataId)); if(userPost != null) FormControl.Data = userPost; } In this example the form data id is hard coded so you will have to add your own logic to supply the correct id for your form data. I hope that this solves your problem.
#14208
Oct 31, 2005 18:11
* 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.