Customizing submit button text
Permalink Browser Info Environment
Hi JordanLev,
I've been looking around for this inquiry beforehand but haven't found a solution. I deal with alot of bilingual websites over here and I've come to adapt Concrete5 to work really good with multilanguage.
I have the ajaxform you developed installed on most websites. It works perfectly except for one minor detail, the submit button displays in a single language, english or french.
I managed to add a field within form_setup_html.php like so (yes, i will need to change the textarea to input) :
to view.php and it works, I can edit the field with edit.php and the text will change, no errors.
The issue relies in controller.php, where it needs to display the submit button's text! This is the part I can't figure out...
I'm not sure how to get the text from the db within controller.php!?
Any help or tips would be greatly appreciated. Thanks
I've been looking around for this inquiry beforehand but haven't found a solution. I deal with alot of bilingual websites over here and I've come to adapt Concrete5 to work really good with multilanguage.
I have the ajaxform you developed installed on most websites. It works perfectly except for one minor detail, the submit button displays in a single language, english or french.
I managed to add a field within form_setup_html.php like so (yes, i will need to change the textarea to input) :
<div class="fieldRow"> <div class="fieldLabel" style=""><?php echo t('Change button Text')?>:</div> <div class="fieldValues"> <textarea name="buttonTxt" cols="50" rows="2" style="width: 95%" class="ccm-input-text" ><?php echo $this->controller->buttonTxt ?></textarea> </div> <div class="ccm-spacer"></div> </div> [\code] and got all the rest to follow so it adds the inserted text within the DB table. For a quick test, I added [code]<?php echo $survey->buttonTxt ?>
to view.php and it works, I can edit the field with edit.php and the text will change, no errors.
The issue relies in controller.php, where it needs to display the submit button's text! This is the part I can't figure out...
echo '<button name="Submit" type="submit" value="'. $buttonTxt .'">'. $buttonTxt .'</button>';
I'm not sure how to get the text from the db within controller.php!?
Any help or tips would be greatly appreciated. Thanks
Type: | Discussion |
---|---|
Status: | New |
Thank you for your quick answer.
Hard coding the word would defeat this whole puzzle! :P
If a user is in the english side of the site, then its fine, but if he/she goes in the french then it will display "Submit" instead of something like "Soumettre"!
I know it's possible and got it to work from view.php, but now I'm at a halt. It's my only issue to get Concrete5 fully bilingual while keeping a friendly UI.
I'm running out of php knowledge to get the $buttonTxt variable showing in the button value...
Thanks again for your expertise.
Hard coding the word would defeat this whole puzzle! :P
If a user is in the english side of the site, then its fine, but if he/she goes in the french then it will display "Submit" instead of something like "Soumettre"!
I know it's possible and got it to work from view.php, but now I'm at a halt. It's my only issue to get Concrete5 fully bilingual while keeping a friendly UI.
I'm running out of php knowledge to get the $buttonTxt variable showing in the button value...
Thanks again for your expertise.
Sorry, not sure what the $buttonTxt thing is -- that doesn't exist anywhere in the Ajax Form template. My limited understanding of the translation system is that there is a localization file somewhere with a bunch of words and phrases in it, one of those translated phrases should be "Submit" -- and then the system should automatically use the translated word. But I'm not an expert on this at all, so you might want to post your question to the general forum. Sorry, wish I could be of more help :(
The word "Submit" is being run through C5's translation function. So you can either set up your site to use a different language (not sure how to do this -- I imagine some kind of localization setting in your php.ini file?), or just hard-code a different word there (keeping in mind that any updates to the package will overwrite your changes so keep a note somewhere about that).