Skip Navigation

[Resolved] Datepicker styles

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by stacyS-2 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1970707
1970581-HMWT_datepicker.png

Quick side question though: Does normal CSS styling not work for date picker fields in the Toolset form? The date picker is awful looking and no CSS I'm applying to it seems to be making it better. (see screenshot)

#1971085

Does normal CSS styling not work for date picker fields in the Toolset form?
Yes, though you may have to override some built-in styles using more specific CSS selectors - hidden link. Some people also create custom jQuery UI themes with the jQuery UI ThemeRoller system, which are pre-rolled design packages for jQuery UI elements like the datepicker - hidden link. That's a fairly advanced feature.

I'd need to see the datepicker in the browser and analyze the styles to understand why those you are trying to apply are not appearing as expected. Do you have a live testing URL? What styles are you trying to apply? Please copy + paste those here for me to review.

#1971167

I've tried half a dozen different CSS attempts at styling the date picker... you can see the latest one , it uses css & js. The other form fields look ok, but the dropdown cal for the date picker looks atrocious, and no piece of CSS I've put in seems to make any change on how the cal displays once clicked.

I stuck the form on a test page & changed the access rules so you can see it w/o logging in: hidden link

CSS

label {
  font: 20px "Varela Round", sans-serif;
}
input[type=text] {
  width: 100%;
  border: 1px solid #F04670;
  border-radius: 10px;
  font: 18px "Varela Round", sans-serif #F04670;
}
input[type=text]:focus {
     border: 5px double #F04670; 
}
input[type=submit] {
    padding:15px; 
    background:#F04670;
	color: #ffffff;
  	font: 22px "Varela Round", sans serif;
    border: 1px solid #F04670;
    cursor:pointer;
    -webkit-border-radius: 5px;
    border-radius: 15px; 
  	box-shadow: 5px 5px 5px #eee;
}
input[type=submit]:hover {
    padding:15px; 
    background:#ffffff;
  	color: #F04670;
    border: 1px solid #F04670;
    cursor:pointer;
    -webkit-border-radius: 5px;
    border-radius: 15px;
  	box-shadow: 5px 5px 5px #eee;
}

.calendar
  position absolute
  width 280px
  left 50%
  top 50%
  margin -145px 0px 0px -140px
  background #fff
  border-radius 4px
  overflow hidden
  box-shadow 0 5px 10px rgba(0,0,0,0.2)

.ui-datepicker-header
  height 50px
  line-height 50px
  color #f26a63
  margin-bottom 10px

.ui-datepicker-prev, .ui-datepicker-next
  width 20px
  height 20px
  text-indent 9999px
  border-radius 100%
  cursor pointer
  overflow hidden
  margin-top 12px

.ui-datepicker-prev
  float left
  margin-left 12px
  &:after
    transform rotate(45deg)
    margin -43px 0px 0px 8px

.ui-datepicker-next
  float right
  margin-right 12px
  &:after
    transform rotate(-135deg)
    margin -43px 0px 0px 6px

.ui-datepicker-prev:after, .ui-datepicker-next:after
  content ''
  position absolute
  display block
  width 4px
  height 4px
  border-left 2px solid #b0aead
  border-bottom 2px solid #b0aead

.ui-datepicker-title
  text-align center

.ui-datepicker-calendar
  width 100%
  text-align center
  thead
    tr
      th
        span
          display block
          width 40px
          color #f26a63
          margin-bottom 5px
          font-size 13px
          text-transform uppercase

.ui-state-default
  display block
  text-decoration none
  color #f26a63
  line-height 40px
  font-size 12px
  &:hover
    background #4da036
    color #ffffff
    border-radius 20px
 .ui-state-highlight
    color #4da036
    font-weight bold

.ui-state-active
  background #4da036
  color #ffffff
  border-radius 20px


.ui-datepicker-unselectable
  .ui-state-default
    color #eee
    border 2px solid gray

JS

$(function() {
  $( "#datepicker" ).datepicker({ firstDay: 1});
});
#1971197

Here may be a much easier / quicker solution:

Can I not either use the Elementor Form block with the Toolset fields.... or even just hand-code an HTML form that utilizes the Toolset custom fields?

I ask, because if you look at the test page I linked in the above comment, it appears my custom Elementor theme is overriding the CSS on the form itself (possibly - it looks that way to me at least). But  – even if it is overriding it partially, it still doesn't explain why the original CRED/Toolset form date picker looks like it does.

#1971377

But – even if it is overriding it partially, it still doesn't explain why the original CRED/Toolset form date picker looks like it does.
The CSS you have pasted above is mostly invalid, starting with the .calendar definition here:

.calendar
  position absolute
  width 280px
  left 50%
  top 50%
  margin -145px 0px 0px -140px
  background #fff
  border-radius 4px
  overflow hidden
  box-shadow 0 5px 10px rgba(0,0,0,0.2)

I'm not familiar with this syntax, is it some kind of shorthand that would eventually be resolved by a CSS compiler system? Not sure if you're accustomed to using a CSS compiler to resolve a shorthand syntax, but as it is now it's not compiled or expanded, it's simply written out to the page. So you've got invalid syntax, and nothing after .calendar will be interpreted because of syntax errors, unless I'm misunderstanding how your CSS system works. Normally the correct CSS syntax looks like this, complete with brackets, colons, and semicolons:

.calendar {
  position: absolute;
  width: 280px;
  left: 50%;
...
}

The original Forms datepicker looks the way it does because it uses the standard jQuery UI theme (orange header / blue text with a gray background for the calendar). As I said, you can use themeroller to roll your own theme, or you can apply individual CSS styles to override that theme. There is a conflict between jQuery UI and the Twenty Twenty One theme that overrides the calendar table's min-width property, which results in the days extending out beyond the background of the table. You can resolve that issue with this code snippet:

#ui-datepicker-div table {
 min-width: inherit;
}

Since you've got invalid CSS as explained above, you should probably place this snippet before the .calendar definition, or fix the syntax of the other code. That will fix the layout so the days don't extend beyond the width of the background.

Beyond that, I would need to see the results once you fix the syntax errors in the other code to understand why overrides aren't working. Let me know when you have an update available and I'll take another look.

#1971499

Follow-up: your "min-width: inherit;" did fix the issue with the days of the week exceeding the box size... but even after fixing all the other css code, it still won't change colors or anything else.

Plus, I found another issue when trying to filter the word counts for only the current month (it was showing me one, singular random word count from last month).

So... I'm just going to code the site instead of trying to manipulate & twist WordPress and plugins into doing my bidding for me LOL It'll be a lot easier in the long run (and much MUCH less headache inducing) 😂