change content of submit button

Permalink 3 users found helpful
I am attempting to change the content of a submit button I am using for a contact form

I can access inspect element for the form, and locate the html and div post, etc, but whenever I try to make my changes, in the value field i cannot make it stick.

Please, how do I make and save my changes to my submit button in my contact form???

Any suggestions on my issue would be greatly appreciated.

Thx
Mike

blackadder
View Replies: View Best Answer
mckoenig replied on at Permalink Reply
mckoenig
One quick and dirty way to do that is to edit the form block controller at line 836 and just change the value attribute:

echo '<tr><td> </td><td><input class="formBlockSubmitButton" name="Submit" type="submit" value="'.t('Submit').'" /></td></tr>';


The better way would be though to set up a language file I guess.
Akadamian replied on at Permalink Reply
Akadamian
i run concrete5 Version 5.6.0 and just managed to change the 'submit' button text :)

*)Open [webserver]/concrete5/concrete/core/controllers/blocks/form_minisurvey.php
*)Edit line 186:
echo '<tr><td> </td><td><input class="formBlockSubmitButton ccm-input-button" name="Submit" type="submit" value="'.t('Submit').'" /></td></tr>';

*)Save

Greets
finegermandesign replied on at Permalink Reply
Is there any way to change the wording in a theme?
alphaboson replied on at Permalink Reply
for me the much cleaner way ist to you the Form Tableless Layout Add-On:
http://www.concrete5.org/marketplace/addons/form-tableless-layout/...

In line 74 you can add your word for Submit.
And because it is in a view file you can customize it much better!
formare replied on at Permalink Reply
formare
Thanks...
nesoor replied on at Permalink Reply
nesoor
thanks! :)
thenine replied on at Permalink Reply
thenine
I found another dirty way, but less dirty since you don´t need to edit the controller core code:

Just add this javascript to the header of the page that has the submit button:

$(document).ready(function(){   
   //here we set the value text 
   var inputValue = "YourSubmitText";
        //here we assign your name to the value of the input
   $('#YourDivID input[type="submit"]').attr("value", inputValue);
});


You just need to locate precisely where the input is, if you just set $('input[type="submit"]' it will change the name of all submit buttons in your page (in case you have more than one).

This way you can assign even different names to different buttons in same page, just matching the precise inputs and using different variables

If you add this code to the default.php page it will be used anytime you create a new page and include a new form.

Sorry for my english if you don´t understand something. It´s not my primary language.

Greets
avpservicesnet replied on at Permalink Reply
This worked like a charm on my site. I added it to the Header Extra Content under Properties on the page with my form and was able to change the submit button text.
htarlov replied on at Permalink Best Answer Reply
htarlov
As of version 5.6 there are three correct ways to do that with core functionality.

One is to add another language and put a translation in it.

Second one is when you don't worry about people without JS - then a script changing submit button text (value) is OK.

Third one is to take concrete/blocks/form/controller.php and copy it to blocks/form/controller.php. Then take method loadSurvey from concrete/core/controllers/blocks/form_minisurvey.php and copy it to MiniSurvey class in blocks/form/controller.php so it will be an override and then change one line of code in it:

echo '<tr><td> </td><td><input class="formBlockSubmitButton ccm-input-button" name="Submit" type="submit" value="'.t('Submit').'" /></td></tr>';


That way even when you update C5 it will not overwrite your change and you don't touch the core.
malkau replied on at Permalink Reply
malkau
All these ways seem overly complicated when we just want to change the text of that button... 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 :)
wyso replied on at Permalink Reply
wyso
Works perfectly for me! Finally a solution!!! Many thanks, Thenine.