Override form submit button (contact form)

Permalink 1 user found helpful
Hi guys,

I'd like to give the form submit button at the contact form a different css class (.btn).
The code for the button is placed in

/concrete/core/controllers/blocks/form_minisurvey.php

Any chance to override this? Or any other idea how to change this without hacking the core after every update?

Best regards

Torsten

tsilbermann
 
lackadaize replied on at Permalink Reply
lackadaize
Pretty certain you should be able to edit it and drop it into root/blocks and you won't have a problem.

I've edited the page_not_found.php at root/concrete/core/controllers/blocks/page_not_found.php before and dropped it into root/single_pages/ without any functionality problems when updating the CMS.
tsilbermann replied on at Permalink Reply
tsilbermann
Hi lackadaize,

copying the form_minisurvey.php to root/blocks did't work.

Regards

Torsten
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Make a folder in your root/blocks folder called form, copy the controller.php from root/concrete/blocks/form/ folder and put into your new folder,
Edit the MiniSurvey class as you desire..
class MiniSurvey extends Concrete5_Controller_Block_FormMinisurvey {//edit here }
ConcreteOwl replied on at Permalink Best Answer Reply
ConcreteOwl
In Concrete 5.6.2.1
To over-ride the submit function your controller.php should be like this
<?php  
defined('C5_EXECUTE') or die("Access Denied.");
class FormBlockController extends Concrete5_Controller_Block_Form {}
class FormBlockStatistics extends Concrete5_Controller_Block_FormStatistics {}
class MiniSurvey extends Concrete5_Controller_Block_FormMinisurvey {
function loadSurvey( $qsID, $showEdit=false, $bID=0, $hideQIDs=array(), $showPending=0 ){
         //loading questions   
         $questionsRS=$this->loadQuestions( $qsID, $bID, $showPending);
         if(!$showEdit){
            echo '<table class="formBlockSurveyTable">';               
            while( $questionRow=$questionsRS->fetchRow() ){   
               if( in_array($questionRow['qID'], $hideQIDs) ) continue;
               // this special view logic for the checkbox list isn't doing it for me
               /*
               if ($questionRow['inputType'] == 'checkboxlist' && strpos($questionRow['options'], '%%') === false){
tsilbermann replied on at Permalink Reply
tsilbermann
Hi weyboat,

Ok, thats too much PHP for me ;)
Could you please explain a bit more how to edit it.
I'd like to change the button class from
<input class="formBlockSubmitButton ccm-input-button" type="submit" value="submit" name="Submit">

to
<input class="formBlockSubmitButton btn" type="submit" value="submit" name="Submit">


Regards
Torsten
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Do your edits in the overridden controller as you have demonstrated,
What are you trying to achieve?
tsilbermann replied on at Permalink Reply
tsilbermann
Sorry, didn't realized that you copied the whole code... of that function ;)
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
No, Only that one complete function..
tsilbermann replied on at Permalink Reply
tsilbermann
Thanks, that works.