Andy2708

Is there a preferred Captcha to use with forms? Google returns quite a few modules, that all seem to have got upgraded to 4, none of which are "official" silverstripe modules

Andy2708

It should straight out of the box AFAIK. Is it outputting input type=email?

Andy2708

@nicxvan I don't think there is an Email dbtype. I think the email field just creates a form input field (Text input field with validation for correct email format according to RFC 2822). You can save this as any kind of dbtype you want.

Andy2708

Guys im having some issues with the htaccess rewrite rules. We are moving from 3 to 4 and had to change the way the multilingual part works. Going from http://domain.com/location-fr-fr to http://domain.com/fr_FR/location. i got that to work fine. The part i can't get to work in the english which is http://domain.com/location going to http://domain.com/en_US/location. I have this RewriteRule ^(?!en_US/(.*)) http://www.google.com/$1 [L,R] and it works with the silverstripe index.php rewrite rules commented out but not when they are left in. Any ideas?

Andy2708

All good. my field was incorrectly set as HTMLText dbtype but a textarea fieldtype. so it wasn't having NL2BR called as per my link. I changed my dbtype to TextField and it worked.

Andy2708

If anyone is wondering, I had my field type set to HTML not Text. https://github.com/silverstripe/silverstripe-framework/issues/5978 for the solution!

Show 1 attachment(s)
patricknelson

I think it's about time this be implemented as a feature in the framework core. Apparently there's no native/intuitive method for users to automatically output/formatted TextareaField content on the front-end. Why is that?

For example: http://stackoverflow.com/questions/4917596/is-it-possible-to-run-a-function-on-a-silverstripe-template-variable-to-format-o/14517067#14517067|http://stackoverflow.com/questions/4917596/is-it-possible-to-run-a-function-on-a-silverstripe-template-variable-to-format-o/14517067#14517067

And solutions like this are needed (this is mine):

class TextFormatterExtension extends Extension {
    /**
     * Chose 'HTMLOut' instead of 'HTML' because that's too generic, could end up overridden in future versions, and
     * 'NL2BR' because it also needs to convert HTML entities unlike nl2br() on its own.
     *
     * @return string
     */
    public function HTMLOut() {
        return nl2br(Convert::raw2xml($this->owner->value));
    }
}

It's so simple, I don't see why this can't be done. Let me know if you agree :smile::+1:

Hide attachment content
Andy2708

in SS3 we had a text area field in the CMS that was populated by the user. We wanted them to be able to insert line breaks but not html. We then wrote a php script that splits \n into <p>. However in 4, when we output that it actually writes the <p> to the screen rather than rendering it in HTML. Is there anyway to force a carriage return in a text area?

Andy2708

Thanks guys, the tips worked perfectly. The script tags were legacy from who i took the site over from, and i just didn't even realize. Nice kick up the butt 😀