@Ramon Lapenta then you'll need to set up the
ContactForm before assigning it to the template variable :)
What do you mean?
the form is set up in the controller, I can use it already with that variable
I was asking about using the same variable/form to output a slight variation of the form (different field IDs) using the same form definition/variable
although TBH the more I think about it the worst it sounds 😕
Different factory method I guess.
forms submit to themselves - so in order to have a factory that expects parameters you have to do a few tricks.
because those parameters will be missing from e.g. the submission.
the thing is, I need the submission to be the same
it is the same form, doing the same thing, just can’t have two identical forms with the same IDs in two parts of the page 😅
Do you need the IDs at all?
Just take them out of the template
So you have a second variable that is essentially
- public function SameSameButDifferentForm()
- $form = $this->Form();
- $form->setID($form->getID() . '--modified');
- return $form;
only like, with real code that would actually execute.
taking the iDs out could be an option 🤔
both ideas could work actually
will do some testing, thank you both
^ I actually do this all the time
$SearchForm('header') to pass it back to
public function SearchForm($ID)
…for this exact purpose
$form->setName($ID); to change to the context variation
forms use the name for all sorts of wild things. Like IDs. You have to bypass a lot of automatic stuff if you want to remove the IDs.
Oh really!… this looks easier!
and this will be passed down to each part of the form and its elements right?
@adrexia thanks for your input yesterday, this works nicely… just having one issue not sure if you’ve encountered it before
This form is being sent via JS, and when I try to send the form empty and expecting error messages (which works fine if I don’t use the
$ID variable), the server is returning this 500 error:
- [Recoverable Error] Object of class SilverStripe\Control\HTTPRequest could not be converted to string
has this ever happened to you?
@Mo yes, give it permission.
It's a pain in the butt for sure, but it is what it is.
My dev env setup includes
sudo chown -R :http public/assets; chmod -R g+w public/assets for that reason :>
Hi there, I have an issue with site search...It's not finding my custom fields in SS4
Hi, I'm trying to populate fixtures using DNADesign's silverstripe-populate module. I'm getting an error where it says it
Can't overwrite existing member #2 with identical identifier. I have tried using
PopulateMergeWhen: "Email = '<mailto:[email protected]|[email protected]>'" but that doesn't seem to work. Anyone have an idea?
@Bevan Shaw has joined the channel
@Rob Clarke has joined the channel
Hi there, how do I upload a Google Verification file that is an html file to my silverstripe website please? It won't allow me to do this and I need to verify a domain for G Suite... thanks in advance
i've never used the file verification, i use the <meta> tag verification method