Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Setting value in Xform posting?

Vote:
 
Can I set the value in a Xform field on pageLoad or on submit? I need to add a page value to a hidden field in a Xform and then pass it along with the posted data. /martin
#12627
May 10, 2006 13:41
Vote:
 
It's possible to set a value for a field when loading a form or when saving form data. You do not even have to have a hidden field for this if you do not want to as it is possible to store additional form data for xforms. Here is an example of how to set form data: private void Page_Init(object sender, System.EventArgs e) { FormControl.BeforeSubmitPostedData +=new SaveFormDataEventHandler(FormControl_BeforeSubmitPostedData); } private void FormControl_BeforeSubmitPostedData(object sender, SaveFormDataEventArgs e) { e.FormData.SetValue("MyCustomField", "SomeValue"); } For more info and examples, please see the alternative xforms user control: http://www.episerver.com/en/EPiServer_Knowledge_Center/developerforum/2628/6042/6043/ See also the new tech note, "Developing with XForms", that was released with the 4.60-documentation: http://www.episerver.com/en/EPiServer_Knowledge_Center/Library/Technical_Notes/
#14624
May 18, 2006 15:14
Vote:
 
I'm trying to do this in 4.61.5.83, but get the following exception message: "Expression must evaluate to a node-set.". Has it changed since last year? Regards, /Patrik
#14625
Jun 13, 2007 20:48
Vote:
 
Never mind, I was apparently trying to use a number as the key, which wasn't valid :) Regards, /Patrik
#14626
Jun 13, 2007 21:36
* 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.