Customizing Form button text

Permalink
I was curious to know if it was possible to edit the text of the submit button directly from the edit window?

Currently, we may edit the form name and Message to display when completed but an option to edit the submit button also would be an advantage. We can easily modify the "submit" text within the controller.php but if clients could have access to change or edit the text, it would be another step to a friendly UI...

I have verify through the files and seems like it could be possible by simply copying the lines of the "thankyouMsg" to something like "submitBtn" throughout every pages that contain thankyouMsg?

Thanks to all who answered/help!

Tallfrog
View Replies:
Pritam replied on at Permalink Reply
Pritam
The feature you requested is currently unavailable in the Form block that comes with Concrete5
Tallfrog replied on at Permalink Reply
Tallfrog
All I need is a way to display a variable within the controller, in this case $buttonTxt.

It's an ajaxform within the market-place! Uses the same hierarchy as the on included within Concrete5, with a few more functions!
Tallfrog replied on at Permalink Reply
Tallfrog
Turns out I'm really close to achieving this! :)

I made a test from the view.php located within the form folder, I inserted:

<?php echo $survey->buttonTxt ?>


and I can see the button text that I've written within the block. If I do edit and change the text, it updates without errors.

How could I get this result in controller.php?
At the form submit button Line, which is at around #646 I updated to:

<button name="Submit" type="submit" value="'.t('Submit').'">'. $buttonTxt .'</button>


I'm almost certain that below line #629 or so something like this would need to be added:
$buttonTxt = $this->...;


And this is where I'm stuck! I haven't found a way to display $buttonTxt in the controller.php document.

Thanks again!
zoinks replied on at Permalink Reply
Yeah, seems like a no-brainer that this should be easy to accomplish rather than a wild goose chase. Been struggling with this for 2 hours. Did you ever figure it out?
Tallfrog replied on at Permalink Reply
Tallfrog
A late response, but I ended up going with the Extended Form.
zoinks replied on at Permalink Reply
well, here's what I did:

- added a new class called "zoinksbutton" in blocks/form/controller.php on line 639 after the other 2 classes.

Then, in my main style.css I added this CSS

.zoinksbutton { text-indent:-9999px; width:120px; height:20px; background:url(images/submit.gif) 0 0 no-repeat; cursor: pointer; }


And of course I uploaded a submit button gif to the images folder.

Not really text customization, but I got the button to look how I wanted.

------------------------------------------------------------------------
MORE DETAILS / update 5/1/2013:
Since I just got a private message about this solution, I was apparently unclear above. So, I took the time to figure out what the heck I was saying back then and here it is in more detail...

The correct file is located at ~root/concrete/blocks/form/controller.php

In my current version of the controller.php file, I see the following line of code for the submit button on line 694:

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


You can see that the input button has 2 classes:
<input class="formBlockSubmitButton ccm-input-button"


...the classes are "formBlockSubmitButton" and "ccm-input-button" ...

In my instructions, what I was saying is that I just put another class after those 2 classes called "zoinksButton" and then I wrote the CSS to style the submit button by styling the zoinksbutton class in my CSS file like this:
.zoinksbutton { text-indent:-9999px; width:120px; height:20px; background:url(images/submit.gif) 0 0 no-repeat; cursor: pointer; }


-----------------------------------------------------------
EDIT #2 (same day)

Well, it appears that the new C5 has broken up the files a little differently. And so here is how what I think you would do now:

If you find concrete/core/controllers/blocks/form_minisurvey.php
you will see the same basic line of code in that file at around line 186. It looks like this:
echo '<tr><td> </td><td><input class="formBlockSubmitButton ccm-input-button" name="Submit" type="submit" value="'.t('Submit').'" /></td></tr>';
echo '</table>';

So, the same instructions apply. Just slide in your new class after the other two like this:

class="formBlockSubmitButton ccm-input-button zoinksbutton"

And style it as an image in your CSS file like this:
.zoinksbutton { text-indent:-9999px; width:120px; height:20px; background:url(images/submit.gif) 0 0 no-repeat; cursor: pointer; }


I don't think this is the best way to do it. Maybe there is something in the controller now that allows you to select an image instead of a submit button. I have no idea, I haven't checked that out yet.
PPPills replied on at Permalink Reply
PPPills
It's 2014 and this method still worked for me - thanks Zoinks!!
I am even calling it a zoinksbutton.
zoinks replied on at Permalink Reply
Holy crap, I must have good karma because I am currently upgrading this ancient site to the latest Concrete5 and I wasted no more than 20 minutes trying to figure out what I did to get that red submit button. I gave up and decided the form has changed, I am not going down one of these undocumented C5 rabbit holes for this silly update. So, THANK YOU for replying at the perfect timing for me to find this old solution again! Crazy timing on this! The gods are smiling down on me, I guess. :)
malkau replied on at Permalink Reply
malkau
I wish changing the form submit text was easier... I don't think we should have to delve into code for something a simple as this. 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 :)