select box not showing first item in list
Permalink
Hello,
I'm sure there is a simple solution to this, but I cannot find where/how I can stop a select box in my contact form displaying '----'
when the page loads instead of the first item in the list, or at the very least the words 'please select'.
Just to make it more irritating, I'm sure I've done this before, but I've looked though every bit of code I can find and still can't find anywhere I can edit this. Can anyone help please,
Thank you in advance,
Bek
I'm sure there is a simple solution to this, but I cannot find where/how I can stop a select box in my contact form displaying '----'
when the page loads instead of the first item in the list, or at the very least the words 'please select'.
Just to make it more irritating, I'm sure I've done this before, but I've looked though every bit of code I can find and still can't find anywhere I can edit this. Can anyone help please,
Thank you in advance,
Bek
I think the default value is coming from the root/concrete/core/controllers/blocks/form_minisurvey.php file around line 241.
case 'select': if($this->frontEndMode){ $selected=(!$_REQUEST['Question'.$msqID])?'selected="selected"':''; $html.= '<option value="" '.$selected.'>----</option>'; }
Thank you for both taking time to answer my question.
Planist1 you are spot on, thank you - that's how I did it previously, but I just couldn't remember where the file was. I'm going to make sure I write it down in my C5 docs now :)
Planist1 you are spot on, thank you - that's how I did it previously, but I just couldn't remember where the file was. I'm going to make sure I write it down in my C5 docs now :)
Glad you were able to get it working. Just to clarify, you will want to make sure you override the function using the process I described in my previous post rather than editing the file directly. If you just edit the file directly your changes will be lost when you update concrete5. You may already know all of this but I just figured I would clarify for anyone reading.
Best of luck
Blake
Best of luck
Blake
Glad you got it working as well. Definitely agree with Blake about using the override function.
Hi, yes thanks for mentioning this, it's exactly the sort of thing I find quite easy to forget to do :)
Any idea on how to get this to work for Concrete 5.8?
So if you create an override controller at /blocks/form/controller.php you will want to set it up like this:
Now you will want to copy the whole loadInputType() function from /concrete/core/controllers/blocks/form_minisurvey.php and paste it into your override. Then in the switch you can change the default option text (for me this is line 35). Or I think you could remove it all together. So to have the default option say ----SELECT---- the whole override controller would look like this:
Like I said, it is possible there is a better way of doing this but it seems to work for me.
I hope that helps.
Blake