Can I somehow put a label right behind a textfield I've put in a custom System > Configuration?
I have added some extra logging procedures that can be activated and the filename for these logs can be added.
But I don't want the user to add '.log' to the filename he/she provides so I want to put '.log' right behind the textfield.
__________
Example: |_________|.log
Is this possible?
More importantly is it possible to do this through my system.xml?
Solved! Go to Solution.
Hi @calidris
Why do you want to add just a static text .log after the text box? It hardly makes any sense you can do same thing by providing comment under the text field.
Even if you mention .log after the text field user may still enter .log in the file name.
The best thing which you can do is handle the file name with .log in you code when you are fetching the value from the text field.
$filename = 'abc.log'; //get the file name dynamically here if( substr($filename,-4)== '.log') { $filename = str_replace('.log','',$filename); } echo $filename; // filename without .log
Hi @calidris
Why do you want to add just a static text .log after the text box? It hardly makes any sense you can do same thing by providing comment under the text field.
Even if you mention .log after the text field user may still enter .log in the file name.
The best thing which you can do is handle the file name with .log in you code when you are fetching the value from the text field.
$filename = 'abc.log'; //get the file name dynamically here if( substr($filename,-4)== '.log') { $filename = str_replace('.log','',$filename); } echo $filename; // filename without .log
Hi @Mukesh Tiwari,
I've learned that users don't usually read comments.
But some static text right after a textfield is not as easily overlooked.
It's just something I was curious about if Magento allowed/enabled it or not.
But I guess not then.
I've already added some checking on the name trough strpos on '.log' but I guess substr is a better method to use.
Thanks!!
(**bleep**! I just remembered that I've added <validate>validate-code</validate> on the textfields so the user can't input a point "." without getting an error. I, accidentally, solved my own problem.)