How to insert current date into tag?

Help
2012-11-05
2013-05-01
  • Hi,

    I've a <date> tag in my XML Schema based XML file, and would like it to take the current date as the default.

    Can this be done wihtin Jaxe?

    Regards,
    verhaaggchm

     
  • Not without a plugin. If you can write in Java, it would not be very difficult to create a new Jaxe element which would create a date element initialized with the current date in the "nouvelElement" method (be aware it would not work within a "form" display type). Look at the developer guide for an example.

     
  • Hi,

    Thanks for your answer! Okay, writing a plugin is the only way to do it.

    I indeed intend to use the from display type as a user interface, but in that case it is not working, oops!

    Regards,
    verhaaggchm

     
  • The form display type (which corresponds to the JEFormulaire Jaxe element) is a bit special: it handles the UI for an element and all its descendants (like the table type for row and cell elements). This is why specifying a different type for one of the descendants doesn't work.

    I'm not sure how you could do it if you want this date to be initialized within a form display type. I see 2 options:
    - using a function instead of a Jaxe element to insert your element initialized the way you want it (the problem with this option is that users might still create uninitialized elements with the insert panel, and you can't control that)
    - create a new Jaxe element which extends jaxe.elements.JEFormulaire, and change the new element with the DOM API in nouvelElement (keeping in mind that the element you change is the ancestor with the form display type)

    If you want to customize the UI with more Jaxe elements, it might be easier to not use the form display type…