21298 Posts in 5735 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 190 Views |
-
Dynamically replace a form

17 February 2012 at 4:50am
Hi SilverStripe Community,
I want to create a contact page which can display different forms. On the right are <button/>-TAGs to switch between the forms.
For example my contact.ss looks like this and my page type has got the functions $FormOne and $FormTwo to return a form:
<div id="Form">
$FormOne
</div>After I click on the 2nd button $FormOne should be replaced by $FormTwo.
-
Re: Dynamically replace a form

18 February 2012 at 12:21am Last edited: 18 February 2012 12:22am
Looking at the options that I can think of:
1. have multiple forms on the page, and show the required one using JavaScript. Considerable overhead, not easy to implement the correct response to the form, spamprotection and stuff, so I wouldn't
2. if the button is pressed, reload the page with the desired form (?form=myform or implement a action/rule?)
3. use AJAX to dynamically load the desired form into some container. Maybe falling back to (2) when no javascript available.
Oh... and the simplest: just have separate pages, each with their own form, replace the custom buttons by a submenu...
| 190 Views | ||
|
Page:
1
|
Go to Top |

