http://coldfusion.com logo
Join Slack
Powered by
# cfwheels
  • b

    Brian Lang

    07/07/2022, 10:41 PM
    Next question. I am migrating an old Legacy CFWheels 1.4.5 site to 2.3.0. I know I can add encode="attributes" wherever I need to to preserve my Bootstrap code in my clickable links, buttons, etc... Is there a way to set this globally? I have a metric-buttload of these that need to be updated if I can't. Thousands and thousands of fixes required....
  • p

    Peter Amiri

    07/07/2022, 10:48 PM
    There is, I'm on my phone let me look up some code and paste in a second.
  • p

    Peter Amiri

    07/07/2022, 10:50 PM
    In your config/settings.cfm file put something like this: // Text/select/password/file Fields set(functionName="textField,textFieldTag,select,selectTag,passwordField,passwordFieldTag,textArea,textAreaTag,fileFieldTag,fileField", class="form-control", labelClass="control-label", labelPlacement="before", prependToLabel="<div class='form-group'>", prepend="<div class=''>", append="</div></div>", encode="attributes" ); You can add any code you need to and it will be used to augment your use of the form helpers.
  • b

    Brian Lang

    07/07/2022, 10:52 PM
    Where in the documentation do I find this?
  • p

    Peter Amiri

    07/07/2022, 10:54 PM
    https://guides.cfwheels.org/cfwheels-guides/working-with-cfwheels/configuration-and-defaults
  • p

    Peter Amiri

    07/07/2022, 10:55 PM
    Look at the section “Function Settings” half way down the page. It shows you how you can set defaults for any of the wheels functions.
  • b

    Brian Lang

    07/07/2022, 10:55 PM
    Perfect. So for my Links I'm just doing this and Instant Results - 10 years of legacy CFWheels code just works 🙂 set(functionname="linkTo", encode="attributes");
  • p

    Peter Amiri

    07/07/2022, 10:59 PM
    Yup, that should do it. Make sure you look at each of the release notes to make sure you don’t have anything else that needs to be done. There were some changes in 2.2 like events/onabort.cfm and findLast() that need to be addressed. May be other stuff along the way but overall it should be pretty easy.
  • b

    Brian Lang

    07/07/2022, 11:00 PM
    I've been through the upgrade guide already. I've addressed those. The big one is going to be to fix or update all the methods from the old Bootstrap plugin that doesn't seem to exist anymore. Not sure if the old plugin works with 2.x yet. I'll be looking at that tomorrow.
  • b

    Brian Lang

    07/07/2022, 11:01 PM
    Cheers!
  • p

    Peter Amiri

    07/07/2022, 11:03 PM
    Let me know if you get stuck with that plugin and we can figure something out. By the way, keep the discussion board in mind as well. https://github.com/cfwheels/cfwheels/discussions that way the messages will get archived.
  • r

    risto

    07/27/2022, 8:15 PM
    Copy code
    Wheels.InvalidAuthenticityToken
    
    This POSTed request was attempted without a valid authenticity token.
    Any way to turn off requiring authenticity token on post? I setup a post route to use a wysiwyg editor's upload url javascript parameter. csrfMetaTags() is in the <head>. It's obviously not getting the token so can I turn off requiring the token on post? I don't see any setting here - https://guides.cfwheels.org/cfwheels-guides/working-with-cfwheels/configuration-and-defaults#csrf-protection-settings
  • r

    risto

    07/27/2022, 8:31 PM
    I probably will have to ask the editor makers if there is a way to send the csfr token it along. If it was my own js function it would be easy to send along.
  • p

    Peter Amiri

    07/27/2022, 8:51 PM
    @risto could you call
    protectsFromForgery(with = "ignore")
    in your controller to make it ignore the check
  • r

    risto

    07/27/2022, 8:52 PM
    @Peter Amiri That's a great temp solution. Thanks! Update - It works!
  • p

    Peter Amiri

    07/27/2022, 8:54 PM
    I'll add that to the API guides.
  • c

    chapmandu

    07/27/2022, 11:09 PM
    Have a look at the sample app too.. there is a pattern there to disable it in the controller config ()
  • r

    risto

    07/27/2022, 11:34 PM
    Nice function I just needed it for one method to handle that Ajax call and ot has the except argument so other functions still covered.
  • c

    chapmandu

    07/27/2022, 11:40 PM
    If you still want csrf via Ajax, have a look at htmx
  • c

    chapmandu

    07/27/2022, 11:41 PM
    Literally a couple of attributes on your form
  • c

    chapmandu

    07/27/2022, 11:44 PM
    It will change your life
  • r

    risto

    07/28/2022, 3:52 PM
    @chapmandu thanks for the info. I took a look at htmx and was impressed with it. Funny enough, @Peter Amiri turned me onto it a few weeks ago. My understanding is if you wrote a jquery (or vanilla js) ajax call with regular form serialization the csfr would automatically be included if you use startFormTag(). Have you tried that before? I will test it soon.
  • a

    Adam Cameron

    08/09/2022, 1:20 PM
    Hoping to get some help with runtime route loading. I'm on CFWheels 1.4.5 I sling this in my config/routes.cfm file:
    Copy code
    addRoute(
    	name="myRoute",
    	pattern="myPattern",
    	controller="myController",
    	action="myAction"
    )
    If I then reload the app, I can then browse to http://localhost/myPattern/myAction, and it runs. Cool. However if I try to do this on the fly, eg:
    Copy code
    addRoute(
    	name="myRoute",
    	pattern="myPattern",
    	controller="myController",
    	action="myAction"
    )
    http method="get" url="<http://localhost/myPattern/myAction>";
    Then the request is handled by the
    /
    route. If I dump out
    application.wheels.routes
    immediately after the
    addRoute
    call, I see
    myRoute
    in the array. Equally, if I dump it out in the
    /
    route view, then I also see it there. So I'm wondering what the missing piece of the puzzle is that I need to do so that it's actually... used. It's like I've set it up, but I've not loaded it or something?
    p
    • 2
    • 4
  • d

    David Belanger

    08/09/2022, 6:05 PM
    I'm not quite understanding the difference Adam. Do you mean that calling the route from within the framework using http isn't working?
  • d

    David Belanger

    08/09/2022, 6:07 PM
    Disclaimer: I'm in the middle of camping trip so responses may be sporadic...
  • d

    David Belanger

    08/09/2022, 6:26 PM
    I'm asking because the CF engine you're using may not be hitting the "rewriter" your web server is using. I've seen this happen in load-balanced environments or reverse proxied test environments where the developer's computer is requesting through the network but CF on the same box as the actual web server and the .htaccess/web.config rules aren't there (especially if you're telling me that you can see your route listed in the array)
    • 1
    • 1
  • a

    Adam Cameron

    09/08/2022, 6:33 PM
    CFWheels has a bug in how it handles the application scope, detailed here: https://blog.adamcameron.me/2022/09/cfml-looking-at-how-cfwheels-messes-up.html Am happy to raise an (abbrev`d) issue for it on GitHub if you like. I had a look and couldn't find an existing one. But if I'm off the mark in my assessment, pls lemme know if you like. #triggerWarning I am unkind about the design of CFWheels in that article. Nothing that isn't warranted, IMO, but I know some ppl consider CFWheels like their pet, not some code so... well... there you go. Be judicious in yer clicking.
    d
    c
    s
    • 4
    • 24
  • a

    Adam Cameron

    09/09/2022, 2:27 PM
    I had a look at what's entailed in doing a pull req before, and read the CONTRIBUTING.MD file. I was left unsure as to what versions of CF and Lucee need to be supported. Might be worth adding that?
    c
    • 2
    • 3
  • p

    Peter Amiri

    09/09/2022, 9:39 PM
    @Adam Cameron and @seancorfield as the maintainer of the CFWheels project can I request that the CFWheels channel on the CFML slack be removed. I am trying to use Github Discussions as the main platform to build and support the community going forward. I appreciate your assistance with this request.
    s
    • 2
    • 6
  • s

    seancorfield

    09/09/2022, 10:39 PM
    All future discussions will take place here: https://github.com/cfwheels/cfwheels/discussions