Adding Classes to Submit Event Form Inputs

Home Forums Calendar Products Community Events Adding Classes to Submit Event Form Inputs

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #956240
    DAVE
    Participant

    Hi guys,

    I was looking over your theming docs as I wanted to add my own classes/id’s and generally modify the form inputs.

    These docs provide me with enough info to modify the form section container div’s but the actual form inputs are output by your Classes, checkbox ex: TribeCommunityEvents::instance()->formCategoryDropdown( null, $currently_selected_category_ids );

    I don’t want to modify your classes for obvious reasons, how best to go about doing this?

    Thanks!

    #956268
    George
    Participant

    Hey Dave,

    Sorry for the limitation here, it indeed seems like there are basically two ways to go about making customizations like this.

    Unfortunately, neither is quite “ideal” – sorry for the frustration there! But the relatively good news is that, for example, if you were to go into the core plugin code and just manually add classes, these are somewhat “presentational” changes. In other words, if you modify these core files like this, and then auto-update when the next version is released, your custom IDs and class names will be gone, but you’re not modifying actual functionality directly in the plugin code, so nothing major should break – you should be able to simply go back to the file, and add the Classes and IDs back to the generated input fields, and be good to go from there.

    If that’s appealing, then simply head to the formCategoryDropdown() method in the plugin code directly. Look for the input fields generated around the bottom of the function. These inputs already have a IDs, so I would not recommend modifying that existing ID (and you can’t add multiple IDs, because, well, there’s only one ID! 🙂 ), but you can definitely add classes to the input element.

    Ideal? No. But super-problematic and risky? I would say “no” to that, too – just keep a backup of your changes and be sure to add them back right after plugin updates.

    —–

    If the method above is still a little too risky for your tastes, that is totally understandable. The next-best option I can think of would be to manually write some JavaScript that changes these input attributes after page load. There are issues with this, as well – if you have CSS that applies to these custom input classes, for example, then it might take a split second for the CSS to take effect while the page loads. There are some workarounds here, and if you’re interested in this route, let me know! I’ll share an example of how to do this via JavaScript.

    Neither option is a “good” one, in any ideal sense – but for the realities of the needs of your project, and to keep code-disruption to a minimum, both are totally usable. Let us know if this information helps, and what route seems most appealing to you!

    — George

    #984030
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Adding Classes to Submit Event Form Inputs’ is closed to new replies.