1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Manually invoke XenForo's 'date' field type.

Discussion in 'XenForo Development Discussions' started by Jake B., Aug 6, 2015.

  1. Jake B.

    Jake B. Well-Known Member

    I'm working on a rather large add-on for a client and part of it is adding multiple form fields into a page via javascript when you click a button. I have this working fine, however, one of the fields is of the 'date' type, but since it is added after the document has been loaded XenForo doesn't make it match all of the other date inputs, it just uses the default behavior of the browser (and in the case of a few it just behaves as a text input field). I was just wondering how I could manually make the function that changes the behavior of this field run manually when that button is clicked and the fields are added.

    A good example of this would be the 'newer than' field in the search page
     
  2. Jake B.

    Jake B. Well-Known Member

    @kylerc got this figured out. Just needed:

    Code:
    XenForo.create('XenForo.DatePicker', $('#ctrl_stage_'+this.lastStageKey+'_start_date'));
    
    while adding the fields :)
     
    kylerc likes this.

Share This Page