View more context

 

nightjarnz

@Ramon Lapenta then you'll need to set up the ContactForm before assigning it to the template variable :)

Ramon Lapenta

the form is set up in the controller, I can use it already with that variable

Ramon Lapenta

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

Ramon Lapenta

although TBH the more I think about it the worst it sounds 😕

nightjarnz

forms submit to themselves - so in order to have a factory that expects parameters you have to do a few tricks.

nightjarnz

because those parameters will be missing from e.g. the submission.

Ramon Lapenta

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 😅

nightjarnz

So you have a second variable that is essentially

  1. public function SameSameButDifferentForm()
  2. {
  3. $form = $this->Form();
  4. $form->setID($form->getID() . '--modified');
  5. return $form;
  6. }
nightjarnz

only like, with real code that would actually execute.

😜 (2)
adrexia

^ I actually do this all the time $SearchForm('header') to pass it back to public function SearchForm($ID)

adrexia

I use $form->setName($ID); to change to the context variation

adrexia

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.

Ramon Lapenta

and this will be passed down to each part of the form and its elements right?

Ramon Lapenta

@adrexia thanks for your input yesterday, this works nicely… just having one issue not sure if you’ve encountered it before

Ramon Lapenta

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:

  1. [Recoverable Error] Object of class SilverStripe\Control\HTTPRequest could not be converted to string

Show less replies
nightjarnz

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 :>

👍 (1)
Rathai

Hi there, I have an issue with site search...It's not finding my custom fields in SS4

jkersu

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?

Rob Clarke

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

Terry Apodaca

i've never used the file verification, i use the <meta> tag verification method