Jaxcent for .NET

Forms Processing in Jaxcent

Forms processing in Jaxcent is not done by the traditional web-programming method of having a "Submit" button, which has a forms-processing page as its target, and the target page has code to decipher the contents of the form.

In Jaxcent, the contents of the form can be queried at any time, by calling JaxcentPage.GetAllFormData.

For processing forms when a button is clicked, a better method than calling JaxcentPage.GetAllFormData is to retrieve form data along with a button click. This can be done by adding a handler to the OnClickWithPageData event, (instead of OnClick events. The button event handler can validate the input data as necessary, and it can use JaxcentPage.Navigate to send the browser to a different page. Or it can use Hide and Show methods to hide a DIV containing the form, and to show a DIV containing the resultang message. The hide/show method can also be used to collect all data from a single page, by hiding and showing different forms.

Data validation can also be done using JavaScript, either by adding data validation code right from Jaxcent by using the AddJavaScriptVerification method available for all HTML elements, or by adding the validator in the HTML on the page.

Form data can also be retrieved when the page is unloaded, by handling the event JaxcentPage.OnFinalFormData.

For data that belongs in a session (i.e. spans multiple pages), Jaxcent can automatically collect the data and put it in the session. See Automatic Handling of Data in Jaxcent via Sessions for details on this.

CHECKBOX and SELECT tags

Data for checkboxes can include multiple selections. If there are multiple values for a given id/name, Jaxcent will return the values as a comma-separated string.

For SELECT tags, Jaxcent returns the data as

<selected-index>: <selected-value>
for example,
3: MySelectedChoice
The JaxcentPage class has convenience methods GetSelectedIndex and GetSelectedValue to retrieve the index and/or the value separately from such a string.