change content of submit button
Permalink 3 users found helpfulI 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
*)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
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!
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
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.
If you think good idea, can you show your support in this thread? Thanks :)
The better way would be though to set up a language file I guess.