https://www.silverstripe.org/community/forums/rss Form Validation: Require that one item of a SelectionGroup is selected https://www.silverstripe.org/community/forums/form-questions/show/122286 <p>I want customers to rate a product from 1-4. I've made a form with a SelectionGroup containing 4 SelectionGroup_Item fields. I'm trying to validate if the customer has made a selection. Server-side it seems to work, the form only goes through when an option is selected. But no error-message is shown if none are selected, so the customer is left in the dark as to why their form wasn't sent. </p><p>Any ideas? Thanks very much! </p><p><div class="codesnippet"><p>$gradeBoxes = array( <br /> new SelectionGroup_Item($this-&gt;Note4, '', $this-&gt;Note4), <br /> new SelectionGroup_Item($this-&gt;Note3, '', $this-&gt;Note3), <br /> new SelectionGroup_Item($this-&gt;Note2, '', $this-&gt;Note2), <br /> new SelectionGroup_Item($this-&gt;Note1, '', $this-&gt;Note1), <br />); <br />$gradeField = new SelectionGroup('Grade', $gradeBoxes); <br />$gradeField-&gt;setCustomValidationMessage('Please select one.'); <br />$fields-&gt;push($gradeField); <br />$required = new RequiredFields(array('Grade')); <br />$form = new Form($this, 'FeedbackForm', $fields, $actions, $required);</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Form Validation: Require that one item of a SelectionGroup is selected | <a href="https://www.silverstripe.org/community/forums/form-questions/show/122286" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/122286" class="replyLink">Post Reply</a></p> Fri, 29 Sep 2017 02:52:44 +1300 https://www.silverstripe.org/community/forums/form-questions/show/122286 Silverstripe CMS login not showing input or password fields https://www.silverstripe.org/community/forums/form-questions/show/122053 <p>I've just started using the Silverstripe framework and up until now the templates have been showing the CMS admin login page. Today something's changed and now I can't login to the CMS dashboard because the login form doesn't show the username or password fields - just the login button and password retrieval link!! I've tried to find a similar issue that's been solved and can't find anything in any of the forums.</p> <br /> <p data-swiftype-index="false">Posted to: Silverstripe CMS login not showing input or password fields | <a href="https://www.silverstripe.org/community/forums/form-questions/show/122053" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/122053" class="replyLink">Post Reply</a></p> Tue, 19 Sep 2017 08:49:58 +1200 https://www.silverstripe.org/community/forums/form-questions/show/122053 Checkboxsetfield and its name attribute https://www.silverstripe.org/community/forums/form-questions/show/121739 <p>Hey folks,<br>first i wanna say HELLO to everyone. I am a silverstripe user for almost a year and a half and now i joined the cummunity because i need your help.</p><p>So lets go: i am using a checkboxfieldset for a frontend form. Additionally i am using the jquery validate plugin for this form. The plugin wants to have its rules in a form like this...</p><p></p><div class="codesnippet"><p>rules{<br>Fieldname:{<br>required:true,<br>minlength:1<br>}<br>}</p></div><p>My problem is that silverstripe generates the fieldset with name-attributes like so: <br></p><div class="codesnippet"><p>name=Fieldname[Value A]</p></div> or <div class="codesnippet"><p>name=Fieldname[Value B]</p></div> and These dont fit to the rules-syntax of the validate plugin. Which has to be <div class="codesnippet"><p>name=Fieldname[]</p></div><p>Either i am using the checkboxfield wrong or i missed to learn a basic html-form-pattern regarding array-name-attributes :D</p><p>I hope you can help me!! ;)</p> <br> <p data-swiftype-index="false">Posted to: Checkboxsetfield and its name attribute | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121739" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121739" class="replyLink">Post Reply</a></p> Thu, 17 Aug 2017 18:00:52 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121739 Re: How to use Include within custom form template https://www.silverstripe.org/community/forums/form-questions/show/121299#post423561 <p>Hey VPull, <br />simply put <strong>CustomBlock.ss</strong> inside <strong>yourmoduleortheme/templates/Includes/</strong> and make sure you flushed the cache like <em>yourwebsite.com/?flush=all</em></p> <br /> <p data-swiftype-index="false">Posted to: How to use Include within custom form template | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121299#post423561" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121299" class="replyLink">Post Reply</a></p> Fri, 04 Aug 2017 10:18:53 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121299#post423561 How to use Include within custom form template https://www.silverstripe.org/community/forums/form-questions/show/121299 <p>Hi all, <br />Is it possible to use include within CustomFormTemplate.ss file? <br />I wanted to display some template data within &lt;form&gt; and &lt;/form&gt;, and I followed the steps from <a href="https://docs.silverstripe.org/en/3/developer_guides/forms/how_tos/lightweight_form/">How to Create Lightweight Form</a> and put <br /><div class="codesnippet"><p>&lt;% include CustomBlock %&gt;</p></div> in CustomFormTemplate.ss , but it is not working </p><p>CustomFormTemplate.ss file is in templates directory not in Include.</p> <br /> <p data-swiftype-index="false">Posted to: How to use Include within custom form template | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121299" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121299" class="replyLink">Post Reply</a></p> Thu, 27 Jul 2017 22:23:36 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121299 How to know which Form was used when a DataObject is saved? https://www.silverstripe.org/community/forums/form-questions/show/121217 <p>Hi, </p><p>I'm not sure if this is the correct category for this question. I have a DataObject upon which I have created an <em>onBeforeWrite()</em> method. Inside that method I need to somehow know where the current saving request came from. If I knew the Form that was used during the request, I could know which fields are available and which are not. </p><p>I can't just use <em>Controller::curr()-&gt;getRequest()-&gt;postVars()</em> to find out which fields were submitted because, well... that would create a security vulnerability. For example I might have an advanced form in the backend that has all kind of fields that are meant for administrators only. Then I might have a more simpler form in the frontend - designed for logged in users but not necessarily admins - that is supposed to change a small set of fields. In this case a hacker could add his own fields to the HTML form and she would be able to alter values that were not designed to be altered a) by non admins and/or b) from the frontend. </p><p>Another considerable way would be to check which Controller is currently in use. This way I could tell if the request originates from the backend or from the frontend. But I might need something more sophisticated just in case if there will be multiple forms inside the backend that would write stuff to this object. </p><p>Thanks for your support! :)</p> <br /> <p data-swiftype-index="false">Posted to: How to know which Form was used when a DataObject is saved? | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121217" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121217" class="replyLink">Post Reply</a></p> Tue, 06 Jun 2017 23:15:43 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121217 How to call a function from checkboxSetField template https://www.silverstripe.org/community/forums/form-questions/show/121210 <p>I have a form with a checkboxSetField list which works as expected. <br />For each checkbox item in the loop I want to call a method, I know this is out of scope so I have created an extension. <br /><div class="codesnippet"><p>CheckboxSetField::add_extension('OperatorFormExtension');</p></div> </p><p>OperatorFormExtension.php <br /><div class="codesnippet"><p>class OperatorFormExtension extends DataExtension { <br /> public function testing($ID) { <br /> return 'hello - '.$ID; <br /> } <br />}</p></div> </p><p>checkboxSetField.ss <br /><div class="codesnippet"><p>&lt;% loop $Options %&gt; <br /> &lt;input id="$ID" class="checkbox" name="$Name" type="checkbox" value="$Value.ATT"&lt;% if $isChecked %&gt; checked="checked"&lt;% end_if %&gt;&lt;% if $isDisabled %&gt; disabled="disabled"&lt;% end_if %&gt; /&gt; <br /> &lt;label for="$ID"&gt;$Title, testing('myParam')&lt;/label&gt;&lt;br&gt; <br /> &lt;% end_loop %&gt;</p></div> </p><p>When I call the method as above I don't get anything displayed on the page. <br />If I extend the Form class instead of CheckboxSetField I can call the testing method from the form but still not from the checkboxSetField template. </p><p>How do I call a method from the CheckboxSetField.ss template?</p> <br /> <p data-swiftype-index="false">Posted to: How to call a function from checkboxSetField template | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121210" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121210" class="replyLink">Post Reply</a></p> Fri, 02 Jun 2017 12:14:53 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121210 Re: Sign Up Form that upon submition adds and entry in a custom Dataobject https://www.silverstripe.org/community/forums/form-questions/show/121202#post423372 <p>Hi @Michael J James, </p><p>Thank you very much for your response. This has been very helpful, it works. </p><p>Just for my curiosity: <br />I was looking in the DataObject class to find how does a DataObject adds entries when you add the from the CMS and use the same php code. Is it by chance the second way you said ? </p><p>Have a great day Michael !</p> <br /> <p data-swiftype-index="false">Posted to: Sign Up Form that upon submition adds and entry in a custom Dataobject | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121202#post423372" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121202" class="replyLink">Post Reply</a></p> Thu, 01 Jun 2017 02:24:05 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121202#post423372 Re: Sign Up Form that upon submition adds and entry in a custom Dataobject https://www.silverstripe.org/community/forums/form-questions/show/121202#post423371 <p>Hi @SilverstripeLearner</p><p>You can do this two ways</p><p>First:<br></p><div class="codesnippet"><p>public function SendSignUpForm($data, $form) {</p><p> $data_FirstName = $data['FirstName'];<br> $data_LastName = $data['LastName'];<br> $data_Email = $data['Email'];<br>   <br> $signup = new SignUpper();<br> $signup-&gt;FirstName = $data_FirstName;<br> $signup-&gt;LastName = $data_LastName;<br> $signup-&gt;Email = $data_Email;<br> $signup-&gt;write();<br>      <br> return $this-&gt;redirect($this-&gt;Link('?name=' . $data_FirstName . ' ' . $data_LastName . '&amp;email=' . $data_Email));<br>}</p></div><p>Second: </p><p>The Second option will only work if the field names are the same as the object db fields</p><p></p><div class="codesnippet"><p>public function SendSignUpForm($data, $form) {</p><p> $data_FirstName = $data['FirstName'];<br> $data_LastName = $data['LastName'];<br> $data_Email = $data['Email'];<br>   <br> $signup = new SignUpper();<br> $form-&gt;saveInto($signup);<br> $signup-&gt;write();</p><p> return $this-&gt;redirect($this-&gt;Link('?name=' . $data_FirstName . ' ' . $data_LastName . '&amp;email=' . $data_Email));<br>}</p></div><p>Thanks<br>Michael</p> <br> <p data-swiftype-index="false">Posted to: Sign Up Form that upon submition adds and entry in a custom Dataobject | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121202#post423371" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121202" class="replyLink">Post Reply</a></p> Thu, 01 Jun 2017 00:17:37 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121202#post423371 Sign Up Form that upon submition adds and entry in a custom Dataobject https://www.silverstripe.org/community/forums/form-questions/show/121202 <p>Hello,</p><p>I have the following Form:</p><p></p><div class="codesnippet"><p>public function SignUpForm() {<br>      $form = Form::create(<br>         $this,<br>         __FUNCTION__,<br>         FieldList::create(<br>            TextareaField::create('FirstName', '')<br>               -&gt;setAttribute('placeholder', 'First Name')<br>               -&gt;addExtraClass('form-control'),<br>            TextareaField::create('LastName', '')<br>               -&gt;setAttribute('placeholder', 'Last Name')<br>               -&gt;addExtraClass('form-control'),<br>            EmailField::create('Email', '')<br>               -&gt;setAttribute('placeholder', 'Email Address')<br>               -&gt;addExtraClass('form-control')<br>         ),<br>         FieldList::create(<br>            FormAction::create('SendSignUpForm', 'Submit')<br>         ),<br>         <br>         RequiredFields::create('FirstName', 'LastName', 'Email')<br>      );<br>      <br>      return $form;<br>   }<br>   <br>   public function SendSignUpForm($data, $form) {<br>      $data_FirstName = $data['FirstName'];<br>      $data_LastName = $data['LastName'];<br>      $data_Email     = $data['Email'];<br>      new SignUpper();<br>      <br>      return $this-&gt;redirect($this-&gt;Link('?name=' . $data_FirstName . ' ' . $data_LastName . '&amp;email=' . $data_Email));<br>   }</p></div><p>SignUpper is a custom object. Everytime someone completes the form, I want a Signupper entry to be added. I don't really know how to continue this. And also<br>later I would like to create a ModelAdmin to see all those entries.</p><p>I'll post here the SignUpper.php file as well:</p><p></p><div class="codesnippet"><p>class SignUpper extends Dataobject {<br>   public static $db = array(<br>      'FirstName' =&gt; 'Varchar(100)',<br>      'LastName'   =&gt; 'Varchar(120)',<br>      'Email'   =&gt; 'Varchar(120)'<br>   );<br>}</p></div><p><strong>EDIT: A custom SQL query would work but I would like that solution to be a last resort situation. I want to do this the right way</strong></p> <br> <p data-swiftype-index="false">Posted to: Sign Up Form that upon submition adds and entry in a custom Dataobject | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121202" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121202" class="replyLink">Post Reply</a></p> Wed, 31 May 2017 23:05:15 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121202 Re: "$.entwine is not a function" error with TreeMultiSelectField in a Front End Form https://www.silverstripe.org/community/forums/form-questions/show/119153#post423363 <p>I'm not entirely sure this would resolve your issue, because I ran into this error message in a different context (using zenvalidator, newest version, which ships with parsley 2.5 and interacts with SS's version of entwine but my site uses jquery 2+). It turns out that in my case the jquery version was so new, it no longer had browser detection built in. So I solved it by adding the jquery browser plugin as suggested through this post: <a href="https://stackoverflow.com/questions/14793331/uncaught-typeerror-cannot-read-property-msie-of-undefined">https://stackoverflow.com/questions/14793331/uncaught-typeerror-cannot-read-property-msie-of-undefined</a></p> <br /> <p data-swiftype-index="false">Posted to: &quot;$.entwine is not a function&quot; error with TreeMultiSelectField in a Front End Form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119153#post423363" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119153" class="replyLink">Post Reply</a></p> Tue, 30 May 2017 00:14:31 +1200 https://www.silverstripe.org/community/forums/form-questions/show/119153#post423363 ListboxField not showing disabled values https://www.silverstripe.org/community/forums/form-questions/show/121196 <p>I have the following field: </p><p><div class="codesnippet"><p>ListboxField::create('ArrayValues', 'ArrayValues:')-&gt;setMultiple(true)-&gt;setSource($formatted_data)-&gt;addExtraClass</p></div> <br />in the $formatted_data variable I stored the values I want to disable. The problem is when i want to select from my dropdown I want to see <br />those disabled values. </p><p>After doing some research with the browser's inspector, I noticed that there is a select that it's actually hidden, and the &lt;option&gt; tags inside have <br />the correct disabled attribute <strong>AND</strong> SilverStripe actually displays those whithin an ul and somehow this ul in linked with the select. </p><p>Anyway, does anyone know what I can do to still be able to see those disabled values ?</p> <br /> <p data-swiftype-index="false">Posted to: ListboxField not showing disabled values | <a href="https://www.silverstripe.org/community/forums/form-questions/show/121196" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/121196" class="replyLink">Post Reply</a></p> Sat, 27 May 2017 01:52:25 +1200 https://www.silverstripe.org/community/forums/form-questions/show/121196 Re: How to set up autoresponders in User Forms module? https://www.silverstripe.org/community/forums/form-questions/show/4719#post422930 <p>Just googling for this exact issue and came across this module that might be helpful. I haven't installed it yet... </p><p><a href="http://addons.silverstripe.org/add-ons/digitalpixelco/userforms-autoresponder">http://addons.silverstripe.org/add-ons/digitalpixelco/userforms-autoresponder</a></p> <br /> <p data-swiftype-index="false">Posted to: How to set up autoresponders in User Forms module? | <a href="https://www.silverstripe.org/community/forums/form-questions/show/4719#post422930" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/4719" class="replyLink">Post Reply</a></p> Wed, 03 May 2017 12:16:21 +1200 https://www.silverstripe.org/community/forums/form-questions/show/4719#post422930 Optionset fields and taxonomies https://www.silverstripe.org/community/forums/form-questions/show/120717 <p>This seems the best place to post this, but if I've misjudged that please move it (if you're a moderator) or let me know. </p><p>We're using <a href="https://github.com/silverstripe/silverstripe-userforms">User Defined Forms</a> and the <a href="http://travis-ci.org/silverstripe-labs/silverstripe-taxonomy">Taxonomy</a> module. We want to integrate the two. Specifically, we want content editors to be able to select any existing taxonomy instead of manually entering options for drop-down lists, checkbox lists or radio button lists. There are two business requirement that make this tricky: <br /><ul><li>the options must be included dynamically, not saved in the <em>EditableOption</em> table</li><li>we can't fork and edit either module - we'll have to use extensions or derive replacement classes</li></ul>. </p><p>Has anyone done something similar? All input is welcome.</p> <br /> <p data-swiftype-index="false">Posted to: Optionset fields and taxonomies | <a href="https://www.silverstripe.org/community/forums/form-questions/show/120717" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/120717" class="replyLink">Post Reply</a></p> Tue, 18 Apr 2017 12:33:10 +1200 https://www.silverstripe.org/community/forums/form-questions/show/120717 Re: Testing email contact forms from local server https://www.silverstripe.org/community/forums/form-questions/show/119948#post422801 <p>As <a href="http://www.blog.tripleroi.com/2012/05/solvedenabling-sendmail-on-localhost.html/">per</a> have updated the sendmail fields in the php.ini files in MAMP (both in MAMP/bin/php/php5.6.10/conf and MAMP/conf/php5.6.10) to: <br /><div class="codesnippet"><p>; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). <br />;sendmail_path =/usr/sbin/sendmail -t -i -f <a href="mailto:ryanachten@gmail.com">ryanachten@gmail.com</a></p></div> </p><p>As <a href="https://www.silverstripe.org/learn/lessons/advanced-environment-configuration/">per</a>, have updated the mysite/_config/config.yml to include: <br /><div class="codesnippet"><p>Email: <br /> send_all_emails_to: 'ryanachten@gmail.com'</p></div> </p><p>All to no avail...does anyone have any suggestions how this might be resolved?</p> <br /> <p data-swiftype-index="false">Posted to: Testing email contact forms from local server | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119948#post422801" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119948" class="replyLink">Post Reply</a></p> Sat, 08 Apr 2017 15:06:39 +1200 https://www.silverstripe.org/community/forums/form-questions/show/119948#post422801 Testing email contact forms from local server https://www.silverstripe.org/community/forums/form-questions/show/119948 <p>Hi there,</p><p>I am building a contact form which sends an email upon submission using a combination of approaches provided in SilverStripe documentation (<a href="https://www.silverstripe.org/learn/lessons/introduction-to-frontend-forms/">Introduction to frontend forms</a>, and <a href="https://docs.silverstripe.org/en/3/developer_guides/forms/how_tos/simple_contact_form//">Simple contact form</a>).</p><p>The code (included below) seems to be working fine, however I am wondering if it is possible to send test emails from a local server (in my case, MAMP) to properly test the functionality.</p><p>Many thanks in advance,<br>racht</p><p></p><div class="codesnippet"><p>public function ContactForm() {<br>         $form = Form::create(<br>            $this,<br>            __FUNCTION__,<br>            FieldList::create(<br>               TextField::create('Name','')<br>                  -&gt;setAttribute('placeholder','Name*')<br>                  -&gt;addExtraClass('form-field'),<br>               EmailField::create('Email','')<br>                  -&gt;setAttribute('placeholder','Email*')<br>                  -&gt;addExtraClass('form-field'),<br>               TextareaField::create('Message','')<br>                  -&gt;setAttribute('placeholder','Message*')<br>                  -&gt;addExtraClass('form-field')<br>            ),<br>            FieldList::create(<br>               FormAction::create('submit', 'Send Message')<br>                  -&gt;setUseButtonTag(true)<br>                  -&gt;addExtraClass('text-button')<br>            ),<br>            RequiredFields::create('Name','Email','Message')         <br>         );</p><p>         $form-&gt;addExtraClass('contact-form');</p><p>         return $form;<br>      }</p><p>      public function submit($data, $form){<br>         $email = new Email();</p><p>         $email-&gt;setTo('email@email.com');<br>         $email-&gt;setFrom($data['Email']);<br>         $email-&gt;setSubject("Contact Message from {$data["Name"]}");</p><p>         $messageBody = "<br>            &lt;p&gt;&lt;strong&gt;Name:&lt;/strong&gt; {$data['Name']}&lt;/p&gt;<br>            &lt;p&gt;&lt;strong&gt;Message:&lt;/strong&gt; {$data['Message']}&lt;/p&gt;<br>         ";<br>         $email-&gt;setBody($messageBody);<br>         $email-&gt;send();</p><p>         $form-&gt;sessionMessage("Thanks for your message, I'll get back to you as soon as I can",'good');</p><p>         return $this-&gt;redirectBack();<br>      }</p></div> <br> <p data-swiftype-index="false">Posted to: Testing email contact forms from local server | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119948" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119948" class="replyLink">Post Reply</a></p> Wed, 05 Apr 2017 09:56:00 +1200 https://www.silverstripe.org/community/forums/form-questions/show/119948 Re: UserForms validation error + Upload field missing https://www.silverstripe.org/community/forums/form-questions/show/111569#post422000 <p>I'm guessing this issue for you quanto has either been resolved or you have moved on? </p><p>Nevertheless, for anyone landing on this question with the same issue, you will need to install the 'secureassets' module for the UploadField to become available within the CMS Form Builder. This is security precaution for all versions of Userforms from version 3.0.0 Final. </p><p>See below for reference: <br /><a href="https://www.silverstripe.org/download/security-releases/ss-2015-018/">https://www.silverstripe.org/download/security-releases/ss-2015-018/</a></p> <br /> <p data-swiftype-index="false">Posted to: UserForms validation error + Upload field missing | <a href="https://www.silverstripe.org/community/forums/form-questions/show/111569#post422000" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/111569" class="replyLink">Post Reply</a></p> Wed, 22 Mar 2017 05:17:53 +1300 https://www.silverstripe.org/community/forums/form-questions/show/111569#post422000 Button Form https://www.silverstripe.org/community/forums/form-questions/show/119893 <p>Sorry,I dont know alot EngLish. <br />I have been some issue. <br />I want to click button then it must transfer page to different page. <br />Help meee :(</p> <br /> <p data-swiftype-index="false">Posted to: Button Form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119893" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119893" class="replyLink">Post Reply</a></p> Tue, 14 Mar 2017 17:25:05 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119893 [SOLVED] ItemEditForm returns "empty tab space" after creating new item https://www.silverstripe.org/community/forums/form-questions/show/119620 <p>Hi,<br>my version is 3.5.1,</p><p>I have this problem, after I create a new item in model admin, ItemEditForm will return "empty tab space" after ajax call and therefore it is handled as "not empty" and it is handled in wrong way what ends in blank page scenario.</p><p>What I have found out yet:<br>1. I submit create new item button<br>2. ajax request is fired:<br>http://localhost/mysite/admin/some-modeladmin/MyItem/EditForm/field/MyItem/item/new/ItemEditForm<br>LeftAndMain.js #498<br>3. on success it gets "nothing" like it should get<br>LeftAndMain.php #514 - return ''; // Actual response will be re-requested by client<br>However somehow there is "empty tab space" before this (in front of it) in returning data and I do not know why yet<br>LeftAndMain.js #506 - success(data, ..) -&gt; data looks like '{empty tab}'.'' and not just like ''<br>So at this point it will "fail" here:<br>LeftAndMain.js #744 - if(!data) return; -&gt; "empty tab space" is not considered as empty so it will continue<br>And finaly it will change content to update to "Content" from "CurrentForm,Breadcrumbs" at<br>LeftAndMain.js #602<br>Blank page is here :-)</p><p>Is this issue fixed in newer releases or? Could you give me a hand where can I trace this "tab"?</p><p>Thanks!</p><p>P.S. It will disappear when I use silverstripe-debugbar module.</p><p>Edit: To clarify, when I move MyItem into another admin it works normally</p><p>FinalEdit: Problem was with tab space before opening php tag in another DataObject file from the ModelAdmin. You can google some details about ajax response data whitespace or take a quick look <a href="https://stackoverflow.com/questions/20653442/ajax-call-or-php-script-add-spaces-to-my-data-result/">here</a>.</p> <br> <p data-swiftype-index="false">Posted to: [SOLVED] ItemEditForm returns "empty tab space" after creating new item | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119620" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119620" class="replyLink">Post Reply</a></p> Fri, 24 Feb 2017 02:22:46 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119620 Log in form field showing FormField.ss https://www.silverstripe.org/community/forums/form-questions/show/119615 <p>My admin log in page is now showing "FormField.ss" instead of the form box. This is the second time it has happened. I have not edited code, just installed and removed modules with composer. <br />Searching has not resulted in any help. <br />Thanks. </p><p>This problem has now occurred in four fresh installs. I haven't been able to pinpoint the cause as not doing the same things when it happens. Going backwards removing modules and changes hasn't worked. Changing the theme has. Any ideas at all please.</p> <br /> <p data-swiftype-index="false">Posted to: Log in form field showing FormField.ss | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119615" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119615" class="replyLink">Post Reply</a></p> Thu, 23 Feb 2017 11:57:07 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119615 "$.entwine is not a function" error with TreeMultiSelectField in a Front End Form https://www.silverstripe.org/community/forums/form-questions/show/119153 <p>I need to select multiple parent / child categories in a front end form, I am using a TreeMultiSelectField to achieve this in SilverStripe 3.5.1 and can successfully populate this dropdown in the CMS Page, but when I add to my front end form the field doesn't render and I get the following errors in the browser console: </p><p><div class="codesnippet"><p>Uncaught TypeError: Cannot read property 'msie' of undefined <br /> at jquery.entwine-dist.js?m=1482356614:757 <br /> at jquery.entwine-dist.js?m=1482356614:801 <br />(anonymous) @ jquery.entwine-dist.js?m=1482356614:757 <br />(anonymous) @ jquery.entwine-dist.js?m=1482356614:801 <br />TreeDropdownField.js?m=1482356614:2 Uncaught TypeError: $.entwine is not a function <br /> at TreeDropdownField.js?m=1482356614:2 <br /> at TreeDropdownField.js?m=1482356614:446</p></div> </p><p>This is my form </p><p><div class="codesnippet"><p>&lt;?php </p><p>class CreateArtifactPage extends ListPage { </p><p> private static $db = array ( ); </p><p> private static $has_one = array( <br /> 'LotteryFeed'&nbsp;&nbsp;&nbsp; =&gt; 'LotteryFeed', <br /> 'ProofImage' &nbsp;&nbsp;&nbsp; =&gt; 'Image' <br /> ); </p><p> private static $many_many = array( <br /> 'Images'&nbsp;&nbsp;&nbsp; =&gt; 'Image' <br /> ); </p><p> private static $belongs_many_many = array( <br /> 'BelongSections' =&gt; 'CatalogueSection' <br /> ); </p><p> public function getCMSFields() { <br />&nbsp;&nbsp;&nbsp;$fields = parent::getCMSFields(); <br /> $internalURLField = TreeMultiSelectField::create('BelongSectionsID', 'Select Section', 'CatalogueSection'); // this works!!!! <br /> $fields-&gt;addFieldsToTab('Root.Main', array($internalURLField)); <br />&nbsp;&nbsp;&nbsp;return $fields; <br /> } </p><p>} </p><p>class CreateArtifactPage_Controller extends ListPage_Controller { </p><p> private static $allowed_actions = array( 'NewArtifactForm' ); </p><p> public function NewArtifactForm() { </p><p> $map = LotteryFeed::get()-&gt;map('ID','Title'); </p><p> // Create fields <br /> $fields = FieldList::create( <br /> TextField::create('Title', 'Name'), <br /> TextField::create('URLSegment'), <br /> TextField::create('Content', 'Description'), <br /> TreeMultiSelectField::create('BelongSectionsID', 'Select Section', 'CatalogueSection'), // returns $.entwine errrors in the console as above <br /> OptionsetField::create('LotteryFeedID', 'LotteryFeed', $map, LotteryFeed::get()-&gt;first()-&gt;ID), <br /> TextField::create('Brand', 'Item Brand'), <br /> TextField::create('Year', 'Year Purchased'), <br /> TextField::create('Location', 'Item Location'), <br /> TextField::create('Price', 'Item Price'), <br /> FileAttachmentField::create('ProofImage', 'Proof of ownership') <br /> -&gt;setThumbnailHeight(80) <br /> -&gt;setThumbnailWidth(80) <br /> -&gt;setMaxResolution(50000000), <br /> FileAttachmentField::create('Images', 'Artifact Images') <br /> -&gt;setThumbnailHeight(80) <br /> -&gt;setThumbnailWidth(80) <br /> -&gt;setMaxResolution(50000000), <br /> CheckboxField::create('IsFeatured', 'Add item to Feature list?'), <br /> CheckboxField::create('EnableComments', 'Allow users to ask questions?') <br /> ); </p><p> // Create actions <br /> $actions = new FieldList( <br /> FormAction::create('submit', 'Create New Item') <br /> ); </p><p> $required = new RequiredFields('Title', 'URLSegment', 'Content', 'Price'); <br /> $form = new Form($this, 'NewArtifactForm', $fields, $actions, $required); </p><p> return $form; <br /> } <br /> // Write data into DataObject <br /> public function submit($data, $form) { <br /> $submission = new Artifact(); <br /> $form-&gt;saveInto($submission); <br /> $submission-&gt;write(); <br /> return $this-&gt;redirectBack(); <br /> } </p><p>}</p></div> </p><p>Can anyone help to resolve this issue?</p> <br /> <p data-swiftype-index="false">Posted to: &quot;$.entwine is not a function&quot; error with TreeMultiSelectField in a Front End Form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119153" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119153" class="replyLink">Post Reply</a></p> Fri, 03 Feb 2017 16:13:23 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119153 How to create an index of the PageType:PageForms URLs https://www.silverstripe.org/community/forums/form-questions/show/119147 <p>I need to create a list of all the URLs that have forms on them for a business project. These forms are all stored in a folder and are PageType:PageForms. Is there a quick way to do this without clicking on each and copying the indiviudal URLs?</p> <br /> <p data-swiftype-index="false">Posted to: How to create an index of the PageType:PageForms URLs | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119147" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119147" class="replyLink">Post Reply</a></p> Tue, 31 Jan 2017 03:31:34 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119147 Re: Integrate reCaptcha with PHP form https://www.silverstripe.org/community/forums/form-questions/show/119123#post421085 <p>Thanks for the advice Kirk <br />It turns out that the code was right <br />I had 2 forms on one page and that duplicated the keys which made the code break</p> <br /> <p data-swiftype-index="false">Posted to: Integrate reCaptcha with PHP form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119123#post421085" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119123" class="replyLink">Post Reply</a></p> Wed, 11 Jan 2017 19:33:56 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119123#post421085 Re: Setting the default value for OptionsetField derived from a list of DataObjects https://www.silverstripe.org/community/forums/form-questions/show/119118#post421084 <p>Thank you Kirk, exactly what I was after :)</p> <br /> <p data-swiftype-index="false">Posted to: Setting the default value for OptionsetField derived from a list of DataObjects | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119118#post421084" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119118" class="replyLink">Post Reply</a></p> Wed, 11 Jan 2017 18:26:00 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119118#post421084 Re: Integrate reCaptcha with PHP form https://www.silverstripe.org/community/forums/form-questions/show/119123#post421083 <p>I can not see any issues with the code. <br />The 2 things I would check is that the relevant spam protection module is installed </p><p><a href="https://github.com/chillu/silverstripe-recaptcha">https://github.com/chillu/silverstripe-recaptcha</a> </p><p>I would also try a dev/build?flush=all as well</p> <br /> <p data-swiftype-index="false">Posted to: Integrate reCaptcha with PHP form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119123#post421083" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119123" class="replyLink">Post Reply</a></p> Wed, 11 Jan 2017 15:54:40 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119123#post421083 Integrate reCaptcha with PHP form https://www.silverstripe.org/community/forums/form-questions/show/119123 <p>Hi all <br />I am having trouble adding the recaptcha spam protection to my form... <br />It works perfectly on my UserDefinedForm but it is not showing up in any php forms that I create <br />The code is as follow <br />//PHP form spam protection added <br /><div class="codesnippet"><p>$form = new Form($this-&gt;owner, 'EnquiryForm', $fields, $actions, $validator); <br />&nbsp;&nbsp;&nbsp;$form-&gt;enableSpamProtection();</p></div> <br />How i added the Recaptcha in mysite/_Config/config.yml <br /><div class="codesnippet"><p>FormSpamProtectionExtension: <br /> default_spam_protector: RecaptchaProtector <br />RecaptchaField: <br /> public_api_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" <br /> private_api_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</p></div> <br />The strange thing is if I use Math Spam protection it shows up but this does not <br />Can anyone help me with this problem?</p> <br /> <p data-swiftype-index="false">Posted to: Integrate reCaptcha with PHP form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119123" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119123" class="replyLink">Post Reply</a></p> Tue, 10 Jan 2017 19:44:54 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119123 Re: Setting the default value for OptionsetField derived from a list of DataObjects https://www.silverstripe.org/community/forums/form-questions/show/119118#post421075 <p>The reason it is not working is because the source you are using from LotteryFeed is going to be an array with the ID of the dataobject as the element key. <br />So try something like this </p><p><div class="codesnippet"><p>$map = LotteryFeed::get()-&gt;map('ID','Title'); <br /> $fields = new FieldList( <br /> OptionsetField::create('LotteryFeedID', 'LotteryFeed', $map, LotteryFeed::get()-&gt;first()-&gt;ID) <br /> );</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Setting the default value for OptionsetField derived from a list of DataObjects | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119118#post421075" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119118" class="replyLink">Post Reply</a></p> Tue, 10 Jan 2017 11:29:42 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119118#post421075 Setting the default value for OptionsetField derived from a list of DataObjects https://www.silverstripe.org/community/forums/form-questions/show/119118 <p>Hey all,</p><p>I have a front end form which requires the selection of a lottery feed using OptionsetField. I need to check the first item by default but I can't get it to work. <br>Before i go completely bonkers, Is there anyone out there able to set me right please? </p><p>Initially this was my field code .</p><p></p><div class="codesnippet"><p>OptionsetField::create('LotteryFeedID', 'LotteryFeed')<br>   -&gt;setSource(LotteryFeed::get()-&gt;map('ID','Title'))</p></div><p>I attempted defining the source as a variable ($map) outside the FieldList and then calling it as follows; using the api example for OptionsetField:</p><p> </p><div class="codesnippet"><p>$map = LotteryFeed::get()-&gt;map('ID','Title');<br> $fields = new FieldList(<br> OptionsetField::create('LotteryFeedID', 'LotteryFeed', $map, $map[0])<br> );</p></div><p>No error on build this time, but it fails to actually check the first item in the list on the template.</p><p>I then attempted to set the default value in the class itself</p><p></p><div class="codesnippet"><p>private static $defaults = array (<br> 'LotteryFeed' =&gt; '[0]' // not sure of the syntax here<br> );</p></div><p>Banging my head against the wall isn't helping, it's no doubt super easy but I cannot find reference to the correct answer.</p><p>Thanks in advance</p><p>Ben</p> <br> <p data-swiftype-index="false">Posted to: Setting the default value for OptionsetField derived from a list of DataObjects | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119118" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119118" class="replyLink">Post Reply</a></p> Fri, 06 Jan 2017 18:59:39 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119118 Re: Global error message if custom form fails validation... https://www.silverstripe.org/community/forums/form-questions/show/40294#post421041 <p>Legend. </p><p>I have very little hair left to pull out, but this seemingly insane workaround did the trick. The Form class should really have some way to intercept its internal validation routine.</p> <br /> <p data-swiftype-index="false">Posted to: Global error message if custom form fails validation... | <a href="https://www.silverstripe.org/community/forums/form-questions/show/40294#post421041" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/40294" class="replyLink">Post Reply</a></p> Tue, 20 Dec 2016 22:05:07 +1300 https://www.silverstripe.org/community/forums/form-questions/show/40294#post421041 Re: Clear Password Field after wrong validation https://www.silverstripe.org/community/forums/form-questions/show/119094#post421034 <p>I would probably try and call the setValue method with a parameter of null on the Password FormField in your validator. <br />You could also achieve this with Javascript as well by checking for a css error class on the Password field and clearing it with Javascript.</p> <br /> <p data-swiftype-index="false">Posted to: Clear Password Field after wrong validation | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119094#post421034" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119094" class="replyLink">Post Reply</a></p> Thu, 15 Dec 2016 16:09:46 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119094#post421034 Clear Password Field after wrong validation https://www.silverstripe.org/community/forums/form-questions/show/119094 <p>Hello. I have big problem with my validation. I have register form and validator extending RequiredFields. Validation works but I cant figure out how to clear password fields after every wrong submit. Password is ConfirmedPasswordField with default validator. </p><p><div class="codesnippet"><p>&nbsp;&nbsp;&nbsp; <br />public function RegisterForm() { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$form = new Form ( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'RegisterForm', <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;getProfileFields('Registration'), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new FieldList( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new LiteralField ('content', $this-&gt;obj('RegistrationContent')), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new FormAction('register', _t('MemberProfiles.REGISTER', 'Register')) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new MemberProfileValidator($this-&gt;Fields()) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $form; <br />&nbsp;&nbsp;&nbsp;}</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Clear Password Field after wrong validation | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119094" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119094" class="replyLink">Post Reply</a></p> Sat, 10 Dec 2016 04:09:52 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119094 How to redirect form to another domain with POST data? https://www.silverstripe.org/community/forums/form-questions/show/119089 <p>I want to create the form which saves record in database and redirects the browser to a POST request to another server. <br />I tried this with <br /><div class="codesnippet"><p>$this-&gt;redirect('http://anotherdomain.com/?var1=value1&amp;var2=value2')</p></div> <br />is that correctway? </p><p>Thanks in advance</p> <br /> <p data-swiftype-index="false">Posted to: How to redirect form to another domain with POST data? | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119089" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119089" class="replyLink">Post Reply</a></p> Thu, 08 Dec 2016 00:25:35 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119089 Submitting form sometimes does a 302 redirect instead of posting https://www.silverstripe.org/community/forums/form-questions/show/119073 <p>Hi, </p><p>I am currently developing a user profile form with a set of 4 checkboxes in a checkboxsetfield. When selecting all 4 the form posts fine and removing the first 2 works fine. For some reason when I have the 3rd and 4th preselected, and decide to remove the 3rd the site does a 302 redirect when I refresh both 3rd and 4th are still selected. When I uncheck the 4th its the same issue. but if I uncheck both it submits fine. I've tried a various number of combinations with the checkboxes but its something too do with the 3rd and 4th checkbox which is performing a 302 redirect on submit. Has anyone else run into this issue before?</p> <br /> <p data-swiftype-index="false">Posted to: Submitting form sometimes does a 302 redirect instead of posting | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119073" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119073" class="replyLink">Post Reply</a></p> Mon, 28 Nov 2016 18:19:51 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119073 Custom UserDefinedForm field https://www.silverstripe.org/community/forums/form-questions/show/119027 <p>Good day <br />I am trying to create a custom field for my userdefined form which will use the $_GET function to get a variable from the url. <br />Basically I want to display a String from the url in a field on my form. <br />Problem is I am completely confused and lost on how I would go about doing this... <br />If anyone has ideas of how I could accomplish this please post <br />I would really appreciate it <br />Thanks in advance</p> <br /> <p data-swiftype-index="false">Posted to: Custom UserDefinedForm field | <a href="https://www.silverstripe.org/community/forums/form-questions/show/119027" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/119027" class="replyLink">Post Reply</a></p> Sat, 12 Nov 2016 01:51:43 +1300 https://www.silverstripe.org/community/forums/form-questions/show/119027 Re: Dropzone module gets 404 response with allowed_actions https://www.silverstripe.org/community/forums/form-questions/show/118673#post420787 <p>Solved. <br />I tried to use $this-&gt;owner-&gt;getRequest()-&gt;params() in my upload form to compose a value for setFolderName().</p> <br /> <p data-swiftype-index="false">Posted to: Dropzone module gets 404 response with allowed_actions | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118673#post420787" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118673" class="replyLink">Post Reply</a></p> Sat, 22 Oct 2016 00:52:07 +1300 https://www.silverstripe.org/community/forums/form-questions/show/118673#post420787 Attribute_Optionfield.js - problems https://www.silverstripe.org/community/forums/form-questions/show/118963 <p>I have ainstalled swipestripe since I would like to create estore. I am currenty strugling with this for days. In admin section I have created a Product page - - product with 8 variations. But when I want to load this page, the second and third dropdown for attributes (options) are not loading any values - - I have read about the similar issue here <a href="https://github.com/swipestripe/silverstripe-swipestripe/issues/85">https://github.com/swipestripe/silverstripe-swipestripe/issues/85</a> - - but this soulution is not working for me. I guess something must be with this js. file - - but I honestly don't have any JS knowledge to see what is going on. I have SS 3.4 and Swipestripe 2.1.0. I would really appreciate any kind of help since I am totally stuck here.</p> <br /> <p data-swiftype-index="false">Posted to: Attribute_Optionfield.js - problems | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118963" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118963" class="replyLink">Post Reply</a></p> Fri, 21 Oct 2016 08:19:37 +1300 https://www.silverstripe.org/community/forums/form-questions/show/118963 Get form field type https://www.silverstripe.org/community/forums/form-questions/show/118958 <p>Hello! <br />In template Form using <br /><div class="codesnippet"><p>&lt;% loop $Fields %&gt; <br /> &lt;input id="$ID" type="$Type" name="$Name" &lt;% if $Required %&gt;required="required"&lt;% end_if %&gt; class="reg-input" placeholder="$Title" value="$Value"&gt; <br />&lt;% end_loop %&gt;</p></div> <br />And I get <br /><div class="codesnippet"><p>&lt;input id="MemberLoginForm_LoginForm_Password" type="text password" name="Password" required="required" class="reg-input" placeholder="Пароль" value=""&gt;</p></div> <br />Incorrect <strong>type="text password"</strong>, how get right <strong>type</strong>?</p> <br /> <p data-swiftype-index="false">Posted to: Get form field type | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118958" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118958" class="replyLink">Post Reply</a></p> Sun, 16 Oct 2016 21:39:08 +1300 https://www.silverstripe.org/community/forums/form-questions/show/118958 Search matches with less than 4 characters https://www.silverstripe.org/community/forums/form-questions/show/118955 <p>It appears that the built-in search is skipping some possible results because the word is too short (4 characters or less, from what I can see.) <strong>Example:</strong> I have a page containing the following text: </p><p><em>The GTD Library folder which these and other library documents are in is replicated in each office.</em> </p><p>If I search for GTD, the page isn't listed in the results. If I search for library, the page is listed in the results. </p><p>Any ideas on how to enable a search of everything down to 2 characters?</p> <br /> <p data-swiftype-index="false">Posted to: Search matches with less than 4 characters | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118955" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118955" class="replyLink">Post Reply</a></p> Fri, 14 Oct 2016 13:57:33 +1300 https://www.silverstripe.org/community/forums/form-questions/show/118955 Using and sending a table within a form https://www.silverstripe.org/community/forums/form-questions/show/118677 <p>Hi there. </p><p>I need a table (4 cols, 10 rows) inside my form the user needs to fill out. I'm using UserForms at the moment. </p><p>Has anyone an idea how to realise that best? </p><p>Any help appreciated. Thanks in advance. </p><p>Best, Mario</p> <br /> <p data-swiftype-index="false">Posted to: Using and sending a table within a form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118677" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118677" class="replyLink">Post Reply</a></p> Wed, 12 Oct 2016 11:02:38 +1300 https://www.silverstripe.org/community/forums/form-questions/show/118677 Dropzone module gets 404 response with allowed_actions https://www.silverstripe.org/community/forums/form-questions/show/118673 <p>How can I use the module with a mypagetype/action/id like url? It works fine with just mypagetype.</p> <br /> <p data-swiftype-index="false">Posted to: Dropzone module gets 404 response with allowed_actions | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118673" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118673" class="replyLink">Post Reply</a></p> Mon, 10 Oct 2016 04:02:21 +1300 https://www.silverstripe.org/community/forums/form-questions/show/118673 Form with SS_HTTPRequest could not be converted to string https://www.silverstripe.org/community/forums/form-questions/show/118646 <p>I have a form that would work if i wouldn't have da Dataobject in it.<br></p><div class="codesnippet"><p>public function AntwortForm($ID) {<br>         </p><p> $Nummer=Vortest_Fragen::get()-&gt;byID($ID);<br>      if ($Nummer) { $Art=$Nummer-&gt;Art;}<br>      if ($Art == "Normal"){<br> $fields = new FieldList(<br> TextAreaField::create('Antwort'),<br> HiddenField::create('ID','ID',$ID),<br> HiddenField::create('VortestID','VortestID',$this-&gt;request-&gt;param("ID")),<br> HiddenField::create('Aktion','Aktion',$this-&gt;request-&gt;param("Action"))<br>         <br> );<br>      } else {<br>         $Optionen = explode(";",$Nummer-&gt;Optionen);<br>         $a = "A";<br>   <br>         for ( $i=0 ; $i&lt;count ($Optionen); $i++) {<br>         $Op[$a] ='&lt;div style="width:25px;display:inline;"&gt;'.$a.')&lt;/div&gt; '.$Optionen[$i];<br>         <br>            $a++;<br>         } <br>         <br>         <br>         $fields = new FieldList(<br> CheckboxSetField::create('Antwort',"Antwort",$Op),<br> HiddenField::create('ID','ID',$ID),<br> HiddenField::create('VortestID','VortestID',$this-&gt;request-&gt;param("ID")),<br> HiddenField::create('Aktion','Aktion',$this-&gt;request-&gt;param("Action")),<br> HiddenField::create('Art','Art',$Nummer-&gt;Art)<br>         <br> );<br>      }<br> $actions = new FieldList(<br> FormAction::create('AntwortEintragen', 'Eintragen')<br> );</p><p> $form = new Form($this, 'AntwortForm', $fields, $actions);<br> return $form;<br> }   <br>   function AntwortEintragen($data, $form) {</p><p>       //Aktion für Schaltfläche, Formulardaten in DB speichern<br>       //existiert der Satz schon?<br>       $Antwort = Vortest_Antwort::get()-&gt;filter(array('FrageID' =&gt; $data['ID'], 'SchreiberID' =&gt; Member::currentUserID()));<br>       //wenn nicht: neu anlegen<br>       foreach($Antwort as $item) { <br>          $item-&gt;delete();<br>         }<br>       <br>       foreach ($data['Antwort'] as $Antwort) {<br>          $Ant.=$Antwort.','; <br>          }<br>         $Antwort = new Vortest_Antwort();</p><p>         <br>       // und immer speichern   <br>       if ($data['Antwort']) {   <br>       $form-&gt;saveInto($Antwort); <br>       if ($data['Art']=="Mechanics") {<br>          $Antwort-&gt;Antwort = $Ant;<br>       } <br>       $Antwort-&gt;SchreiberID=Member::currentUserID();<br>       $Antwort-&gt;FrageID=$data['ID'];<br>       $Antwort-&gt;write();<br>       }<br>       $VID=$data['VortestID'];<br>       // und zurück auf die Erfassungsseite mit leerem Formular<br>      if ($data['Aktion']=="AlleFragen") {<br>         $this-&gt;redirect('/vortest/AlleFragen/'.$VID.'#'.$data['FrageNr']);<br>      } elseif ($data['Aktion']=="Einzelfrage") {<br>         $this-&gt;redirect('/vortest/Einzelfrage/'.$VID);<br>      } else {<br>       $this-&gt;redirect('/vortest/Test/'.$VID.'#'.$data['FrageNr']);<br>       }<br> }</p></div><br>It works when I change the $ID to a number in this line $Nummer=Vortest_Fragen::get()-&gt;byID($ID);<br>When I don't change it I get this message.<br>[Recoverable Error] Object of class SS_HTTPRequest could not be converted to string<p>What can I do?</p> <br> <p data-swiftype-index="false">Posted to: Form with SS_HTTPRequest could not be converted to string | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118646" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118646" class="replyLink">Post Reply</a></p> Fri, 23 Sep 2016 00:32:45 +1200 https://www.silverstripe.org/community/forums/form-questions/show/118646 [Notice] Array to string conversion in template form https://www.silverstripe.org/community/forums/form-questions/show/118607 <p>Good day <br>I have received a [Notice] Array to string conversion error when trying to change one of my input fields to a array. I believe that it is because I do not have it set to a variable.<br>this is a field that i am getting the ID of my items and this works.<br></p><div class="codesnippet"><p>&lt;input type="hidden" id="ID" name="ItemID[]" value="$ID"class="form-control"&gt;</p></div><br>when i try to add this to the post I receive the notice.<br><div class="codesnippet"><p>&lt;input type="number" id="Amount" name="Amount[]" value="0" class="form-control"&gt;</p></div><p>If anyone has a idea of what i can do about this issue.<br>It would be much appreciated<br>Thanks<br>Skullies</p> <br> <p data-swiftype-index="false">Posted to: [Notice] Array to string conversion in template form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118607" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118607" class="replyLink">Post Reply</a></p> Sat, 27 Aug 2016 01:18:00 +1200 https://www.silverstripe.org/community/forums/form-questions/show/118607 Re: Form + email question https://www.silverstripe.org/community/forums/form-questions/show/118580#post420314 <p>Very possible that you don't have sendmail - as hackers would love that to send emails from your server so many hosts disable it. I'd contact the host first. </p><p>However I'd recommend using <a href="https://github.com/markguinn/silverstripe-email-helpers">https://github.com/markguinn/silverstripe-email-helpers</a> to convert to SMTP or use something like mailgun with this module <a href="https://github.com/kinglozzer/silverstripe-mailgunner">https://github.com/kinglozzer/silverstripe-mailgunner</a></p> <br /> <p data-swiftype-index="false">Posted to: Form + email question | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118580#post420314" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118580" class="replyLink">Post Reply</a></p> Mon, 15 Aug 2016 22:53:01 +1200 https://www.silverstripe.org/community/forums/form-questions/show/118580#post420314 Form + email question https://www.silverstripe.org/community/forums/form-questions/show/118580 <p>Hi guys, <br>I am new to SilverStripe and just finished/uploaded a SilverStripe site to a server. i have two issues, first is about the contact form and targeting each input field for customisation. i have used a custom form template and i needed to access each input field. i tried $Fields.dataFieldByName(name) and $Fields.FieldByName(email) but they don't work. i ended up using &lt;% control Fields %&gt; $Field &lt;%end_control&gt; which does not give me individual unique styling option for each of my form $Fields. this is what i like to do: <br>&lt;div class="input-field col s12"&gt;<br> &lt;i class="material-icons prefix"&gt;account_circle&lt;/i&gt;<br> $Fields.dataFieldByName(name) <br> &lt;label for="name"&gt;Name&lt;/label&gt;<br> &lt;/div&gt; </p><p>the other question is about me getting an email after form submission. i have used this: <br>$email = new Email();<br> $email-&gt;To = "me@myemail.co.nz";<br> $email-&gt;From = $data['email'];<br> $email-&gt;Subject = "A message from : ".$data['name'];;<br> $email-&gt;Body = $data['message'];<br> $email-&gt;send();<br>this works fine on my localhost but now that i have uploaded the project on my Digital Ocean server it does not send me emails upon form submission. am i missing something here? <br>thank you for your help<br>Beshad</p> <br> <p data-swiftype-index="false">Posted to: Form + email question | <a href="https://www.silverstripe.org/community/forums/form-questions/show/118580" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/118580" class="replyLink">Post Reply</a></p> Mon, 15 Aug 2016 10:52:44 +1200 https://www.silverstripe.org/community/forums/form-questions/show/118580 Re: Creating a new custom form (Not using the CMS Controllers) https://www.silverstripe.org/community/forums/form-questions/show/111942#post420266 <p>Hi, </p><p>I'm no expert, but I think I spot a few problems here. </p><p>The biggest issue I see is that the allowed action of 'addForm' does not match the name of the function which is just 'add'. Please try calling the function addForm to match the rest of the code. </p><p>Also I am wondering, if you are not using the CMS package can someone be logged in as ADMIN? For the allowed actions have you tried changing 'addForm' =&gt; 'ADMIN', to just 'addForm'? </p><p>Also where the form is defined $form = new Form($this, 'addForm', $fields, $actions, $required); the variable $required is not created/specified anywhere beforehand. </p><p>Hope this helps.</p> <br /> <p data-swiftype-index="false">Posted to: Creating a new custom form (Not using the CMS Controllers) | <a href="https://www.silverstripe.org/community/forums/form-questions/show/111942#post420266" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/111942" class="replyLink">Post Reply</a></p> Mon, 01 Aug 2016 21:26:28 +1200 https://www.silverstripe.org/community/forums/form-questions/show/111942#post420266 Re: Form Validation https://www.silverstripe.org/community/forums/form-questions/show/111879#post420265 <p>Hi, </p><p>Take a look a the Zen Validator module. <a href="https://github.com/sheadawson/silverstripe-zenvalidator">https://github.com/sheadawson/silverstripe-zenvalidator</a>. In my opinion this is the best validator module for SilverStripe. </p><p>In particular the "Validation Logic - Conditional Constraints" near the end of the readme which mentions using "Display Logic" like conditions. You could use this to only require certain fields, such as when the delivery option is free or not free. </p><p>In your function which creates the form fields... </p><p><div class="codesnippet"><p>$TradeAddress1-&gt;validateIf('DeliveryOption')-&gt;isEqualTo('free'); <br />$TradeAddress2-&gt;validateIf('DeliveryOption')-&gt;isEqualTo('free'); </p><p>$CustomerAddress1-&gt;validateIf('DeliveryOption')-&gt;isEqualTo('not-free'); <br />$CustomerAddress2-&gt;validateIf('DeliveryOption')-&gt;isEqualTo('not-free');</p></div> </p><p>Then create this function below the one which creates the form fields... </p><p><div class="codesnippet"><p>public function getCMSValidator() <br />{ <br /> $validator = ZenValidator::create(); </p><p> $validator-&gt;addRequiredFields( <br /> array( <br /> 'TradeAddress1', <br /> 'TradeAddress2', <br /> 'CustomerAddress1', <br /> 'CustomerAddress2', <br /> ) <br /> ); </p><p> return $validator; <br />}</p></div></p> <br /> <p data-swiftype-index="false">Posted to: Form Validation | <a href="https://www.silverstripe.org/community/forums/form-questions/show/111879#post420265" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/111879" class="replyLink">Post Reply</a></p> Mon, 01 Aug 2016 16:31:11 +1200 https://www.silverstripe.org/community/forums/form-questions/show/111879#post420265 Re: Need help with form https://www.silverstripe.org/community/forums/form-questions/show/21455#post420083 <p>I am sorry for reviving this very dead thread.. </p><p>Is there something like this available now? Have been looking all over to do this but nothing seems to work exactly (except probably the javascript way mentioned below)</p> <br /> <p data-swiftype-index="false">Posted to: Need help with form | <a href="https://www.silverstripe.org/community/forums/form-questions/show/21455#post420083" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/21455" class="replyLink">Post Reply</a></p> Sat, 09 Jul 2016 01:54:03 +1200 https://www.silverstripe.org/community/forums/form-questions/show/21455#post420083 setFormAction after form has been returned https://www.silverstripe.org/community/forums/form-questions/show/117122 <p>Hi there,<br>Is there a way to send form data to an external URL after the form has been returned? setFormAction only works before.</p><p> </p><div class="codesnippet"><p>public function PayForm() {<br>             <br> $fields = new FieldList(<br> TextField::create('USER1', 'Name and Surname'),<br>         TextField::create('EMAIL', 'Email')         <br> );</p><p> $actions = new FieldList(<br> FormAction::create("doPayment")-&gt;setTitle("Pay Now")<br> );</p><p> $required = new RequiredFields('Name');<br> $form = new Form($this, 'PayForm', $fields, $actions, $required);<br>      $form-&gt;setFormMethod('GET');<br> return $form;<br> }</p><p> public function doPayment($data, Form $form) {<br>      $data['CHECKSUM'] = md5($data['NAME'].$data['SURNAME']);<br>      $form = new Form($this, 'doPayment', $fields, $actions, $required);</p><p>      //Send data to URL here<br>      <br>   }<br>}</p></div> <br> <p data-swiftype-index="false">Posted to: setFormAction after form has been returned | <a href="https://www.silverstripe.org/community/forums/form-questions/show/117122" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/117122" class="replyLink">Post Reply</a></p> Fri, 10 Jun 2016 22:39:06 +1200 https://www.silverstripe.org/community/forums/form-questions/show/117122 Creating a new custom form (Not using the CMS Controllers) https://www.silverstripe.org/community/forums/form-questions/show/111942 <p>Hi Experts, </p><p>I am trying to create a new custom form that is extended from the "Controller" class. I have seen many tutorials but all the controllers are extending from CMS Controllers. I am trying to use the case when the CMS bundle/package is not included and building it from scratch. Here is my code i.e. </p><p>Controller location: mysite/code/controllers/GalleryController.php <br /><div class="codesnippet"><p>class GalleryController extends Controller { <br /> private static $allowed_actions = array( <br /> 'index', <br /> 'addForm' =&gt; 'ADMIN', <br /> ); </p><p> public function index(SS_HTTPRequest $request) <br /> { <br /> return $this-&gt;getResponse(); <br /> } </p><p> public function add(SS_HTTPRequest $request){ <br /> $fields = new FieldList( <br /> TextField::create('imageName', 'Image Name') <br /> ); </p><p> $actions = new FieldList( <br /> FormAction::create("galleryActMsgs")-&gt;setTitle("Gallery Images Area") <br /> ); </p><p> $form = new Form($this, 'addForm', $fields, $actions, $required); </p><p> return $form; <br /> } </p><p> public function galleryActMsgs($data, Form $form){ <br /> $form -&gt;sessionMessage("Data Saved Successfully....", 'success'); </p><p> return $this-&gt;redirectBack(); <br /> }</p></div> </p><p>Template file created at: mysite/templates/GalleryController_add.ss <br /><div class="codesnippet"><p>$addForm</p></div> </p><p>URL to access the above controller i.e. <br /><div class="codesnippet"><p>http://localhost:8011/ss_pac/gallery/addForm <br />NOTE: The above URL was working fine before adding form code.</p></div> </p><p>Error by accessing the above url: <br /><strong>There seems to have been a technical problem. Please click the back button, refresh your browser, and try again.</strong> </p><p>I tried the following steps i.e. <br />http://localhost:8011/ss_pac/dev/build?flush=all The above url build everything without any error. <br />http://localhost:8011/ss_pac/gallery/addForm?flush=1 This gives the same above error. </p><p>Looking for a quick help on it and hope this will be helpful for others as well. </p><p>Cheers, <br />Naveed.</p> <br /> <p data-swiftype-index="false">Posted to: Creating a new custom form (Not using the CMS Controllers) | <a href="https://www.silverstripe.org/community/forums/form-questions/show/111942" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/111942" class="replyLink">Post Reply</a></p> Tue, 10 May 2016 10:49:56 +1200 https://www.silverstripe.org/community/forums/form-questions/show/111942 ModelAdmin - Intercept edit form submit https://www.silverstripe.org/community/forums/form-questions/show/111931 <p>There is following Notification DataObject </p><p><div class="codesnippet"><p>class Notification extends DataObject { </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private static $db = array ( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Message' =&gt; 'Text', <br /> //... <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;); </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private static $has_one = array( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Member' =&gt; 'Member', //the recipient <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//... <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;); </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//... <br />}</p></div> </p><p>The important part is the has_one relationship with a member. This can't be changed to a many_many relationship. <br />But, for practical reasons, I want our customer to be able to send a notification to multiple customers at once. Therefore I added the following fields to the notification objects getCMSfields method: </p><p><div class="codesnippet"><p>HeaderField::create('SentToHeader', 'Notification senden an...'), <br />ListboxField::create('Member', '...folgende Mitglieder', $members)-&gt;setMultiple(true), <br />ListboxField::create('Membership', '...Mitglieder folgender Mitgliedschaften', $memberships)-&gt;setMultiple(true),</p></div> </p><p>So far, everything is fine. <br />Now I need to somehow intercept the submit and instead of creating a single notification, create notifications foreach selected member (or for each member in each selected membership). I don't wan't to do this in the notifications onBeforeWrite because I feel like this is a very hacky solution. </p><p>Now to my question: <br />Can I somehow intercept the forms submit event in my model admin and prevent it's default behavior (creating a single new notification) and instead create as many new notification objects as needed? </p><p>Thanks in advance</p> <br /> <p data-swiftype-index="false">Posted to: ModelAdmin - Intercept edit form submit | <a href="https://www.silverstripe.org/community/forums/form-questions/show/111931" class="showLink">Show Thread</a> | <a href="https://www.silverstripe.org/community/forums/form-questions/reply/111931" class="replyLink">Post Reply</a></p> Wed, 04 May 2016 03:13:41 +1200 https://www.silverstripe.org/community/forums/form-questions/show/111931