We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

[Closed] Channel Form styling - CSS referencing #cform

Development and Programming

Steve Garcia's avatar
Steve Garcia
52 posts
3 years ago
Steve Garcia's avatar Steve Garcia

Just spend some time trying to get a datepicker in a Channel Form to work in EE6.0.3. Using the basic instructions here (https://docs.expressionengine.com/latest/channels/channel-form/overview.html#basic-usage) and here (https://docs.expressionengine.com/latest/channels/channel-form/inputs.html#entry-date) it tells me to include the channel form css which I did. What I didn’t notice until I loaded the css file in an editor is all references to #cform in the css file. I was having an issue getting the datepicker to work correctly. It would load but not function as it was supposed to. What I realized is the datepicker doesn’t work correctly unless I add id=”cform” to the channel form itself.

I’m not sure why this would be needed when I give my forms their own id; Is this ID supposed to be loaded somewhere else or do I need to ID all my channel forms with cform? This doesn’t seem correct as I may have more than one form on a page; it seems this should be a class and not an ID.

Here’s the bare basics of my code:

{exp:channel:form channel="project" include_jquery="no" json="yes" class="cf-ajax-form gsm-form" id="new-project" datepicker="yes" include_assets=”yes"}

<input type="text" name="project_acceptance_date" value="{project_acceptance_date format='%n/%j/%Y %g:%i %A'}" maxlength="23" size="25" rel="date-picker" data-timestamp="{project_acceptance_date}" data-date-format="%n/%j/%Y %g:%i %A"></p>

{/exp:channel:form}

I’m loading jquery manually which is the reason for the parameter. The only way the datepicker works is if I either wrap everything in a #cform div or replace my form ID with id=”cform” which neither seem right.

Am I missing something?

       
Andy McCormick's avatar
Andy McCormick
183 posts
3 years ago
Andy McCormick's avatar Andy McCormick

Channel Forms is definitely an area that we need to review. I believe in EE 2 and maybe some version between 2 and 6, #cform was automatically added to all channel forms (or #cform wasn’t in the CSS, one of the parts was missing/changed). I’ve ran into that issue a lot when running upgrades.

We should probably at least add to the docs that for the default styling to work, the ID needs to be added to the form. thanks for bringing this up.

       
Steve Garcia's avatar
Steve Garcia
52 posts
3 years ago
Steve Garcia's avatar Steve Garcia

Thanks Andy, I’m somewhat glad to hear this is a known issue as I was banging my head against the keyboard the past few days thinking I was missing something. This is my first foray into EE6 so I was chalking it up to user error. For now I’ll wrap my forms with a div so I can keep moving forward.

Thanks for the reply!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.