In order to create custom Processing please follow instruction below.
- From Centralpoint\WebSites\cpweb_Development\Root\App_Code\DevV copy CustomInvokeMethod method into your cp:scripting file. Rename the Method to better describe what it will do in your system. Or you can copy example from a section code below.(Custom Form Processing Method)
- Rename the Method to better describe what it will do in your system.
- In the forms > Processing Tab check Custom = Yes (see #1 on the image below)
- In Method Name change the name to Method you just chose. (see #2 on the image below)
- Save the form.
public static void CustomFormProcessingMethod(object[] parameters)
{
Centralpoint.WebSite.Page page = (Centralpoint.WebSite.Page)parameters[0];
//FormGroup form = (FormGroup)parameters[1]; // not used in this example. Let you get all the parameters of the form. We will retrieve those using GetFormValue method.
string formProssesParameter = parameters[2].ToString(); // see #3 on the image below. you can pass any additional parameters or scripts from the console.
HttpContext.Current.Trace.Warn("formProssesParameter", String.Format("{0}", formProssesParameter));
string name = page.CpScripting.GetFormValue("Name"); // Id of the form Control. Form line 2
HttpContext.Current.Trace.Warn("CustomFormProcessingMethod", String.Format("{0}", name));
// Id of the form Control. The value of that control are 0 and 1. Form line 4
bool workHereBefore = (page.CpScripting.GetFormValue("workHereBefore").Equals("1")) ? true : false;
if(workHereBefore)
{
//TODO: implement your logic for the case if the value is true(1).
}
else
{
//TODO: implement your logic for the case if the value is false(0).
}
}
See Image:
CustomFormProcessing.png
Keywords: Form
Related CodeSamples Records