Change text of Submit button in Concrete5.6.1.2

Permalink 1 user found helpful
I have been making myself nuts working on this today. No matter what I do, I can not get the text of the Submit button to change on a form. I have made a seperate template and copied the form_minisurvey.php into the template folder but it still pulls the text from the default. I am doing a multilingual page and so it won't work to change the core. Can anyone help me with this?

 
jasteele12 replied on at Permalink Reply
jasteele12
First, make sure you have turned off the Overrides Cache:
System & Settings > Cache & Speed Settings > Disable "Overrides Cache"
If it was on, clear the cache.

Then copy concrete/blocks/form/controller.php to blocks/form/controller.php

Copy the entire loadSurvey() function from concrete/core/controllers/blocks/form_minisurvey.php (lines 140-215)

Edit blocks/form/controller.php so it looks 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 {
    // here we override the core class function to change t('Submit')
  function loadSurvey( $qsID, $showEdit=false, $bID=0, $hideQIDs=array(), $showPending=0 ){
    ...
  }
}


Notice how the entire function is inside the MiniSurvey class.

Change the t('Submit') inside there and you should be good to go.

John
weiala replied on at Permalink Reply
Thanks for the reply John! I did exactly what you suggested and still get "Submit" instead of the text I want. I don't understand why it is not overriding the core. Do you have an idea?
shahroq replied on at Permalink Reply
shahroq
Changing form block labels always is pain in the neck, if you do not want to change anything at the core, simplest way would be using jquery. create a template, select every element you want and change its label/values.
weiala replied on at Permalink Reply
Thanks for the reply. I don't know my way around jquery that well. Is there help on the net to figure that out or how would I search it?
jordanlev replied on at Permalink Best Answer Reply
jordanlev
Use the "Form Tableless Layout" custom template (http://www.concrete5.org/marketplace/addons/form-tableless-layout/... ), which has plain old markup for the submit button. Just change this line at the bottom of the template to whatever you want:
<input type="submit" name="Submit" class="submit" value="<?php  echo $translatedSubmitLabel; ?>" />


-Jordan
weiala replied on at Permalink Reply
Although I didn't really want to spend the time to style the form, asfter struggling so long having to style it seemed like a breeze. Thanks for encouraging me to use your great addon Jordan! And thanks to everyone who tried to help!
malkau replied on at Permalink Reply
malkau
I really think this text needs to be easier to edit. It seems like a common requirement for us all to want to change the text to something more useful than the default. It should be editable via the form editor in my opinion... so I've posted a feature suggestion.https://www.concrete5.org/community/forums/5-7-discussion/feature-re...
If you think good idea, can you show your support in this thread? Thanks :)