WS-ExternInclude().
The form template is built so that it supports both ways. It can still be called via a normal link, even if no JavaScript is running in the browser.
Starting point
There is a templatepage_inquiry.htm that can be reached via a link from the product detail view ws_product.htm.
page_inquiry.htm:
The
PR-DepVarLink parameter ensures that the data of the product in question is passed to the form. Without it, the form doesn’t know what the question refers to.Step 1: Include the JavaScript library
In the head section of the product detail view, include the WEBSALE system library and the associated design component. If it is already included, it must be at least version 1.8.1.Step 2: Create the three containers
Create three areas on the product detail view. The script always shows exactly one of them.The content container has the same name as the AJAX bracketing in step 5. The script uses this name to find the place where the loaded content belongs.
Step 3: Set the triggering link
The first two callback functions are passed without quotation marks, the last two as a string with parentheses. This is not a mistake; it is how the library is designed.
Step 4: Write the four callback functions
These functions belong in the design component of the system library, not in the library itself.The third function shows the same container as the second. This is intentional: a form with input errors is not a connection error, and the customer should see their input along with the error messages. Only the fourth function shows the error container.
Step 5: Bracket the area to be loaded
Onpage_inquiry.htm, place an AJAX bracketing around the area that should go into the container. The markers themselves are additionally bracketed with ST-Ajax so that they don’t end up in the source code when the page is called normally via a link.
Step 6: Give the form a unique ID
Step 7: Trigger submission via AJAX
Attach an event to the submit button. Because the button has to look different for a normal call than for an AJAX call, it exists twice.ST-Ajax applies if the current request was an AJAX request. The negated form !ST-Ajax applies to a normal page call. This way, one template supports both ways without you having to maintain it twice.Tracking
If you use the tracking interface, follow its notes on AJAX-based functions. An area loaded via AJAX does not trigger a page view and is therefore not counted unless you take action. Guide: Description of the tracking interfaceRelated topics
- Guide: Forms for customer inquiries
- Guide: AJAX functions
- Guide: Description of the tracking interface
