NewsPublisher Pagetitle preset seems to override other presets

I have pagetitle preset in use in a NewsPublisher call:

pagetitle:daily-sheet-[[!+nowdate:default=`now`:strtotime:date=`%Y-%m-%d`]]

For usage in templates, I added:

menutitle:Daily Sheet: [[!+nowdate:default=`now`:strtotime:date=`%m-%d-%y`]]

The menutitle preset appears as formatted in the NewsPublisher form, but is overwritten by the pagetitle preset when the form is processed.

I removed the colon, used dashes instead of whitespace, and replaced the nowdate placeholder with “foo”, in the event that this is an undiscovered NP quirk. In all cases, menutitle is still overwritten.

Lastly, I placed a longtitle preset:

&presets=`longtitle:foo,menutitle:foo,pagetitle:daily-sheet-[[!+nowdate:default=`now`:strtotime:date=`%Y-%m-%d`]]`

All presets appear in the form, but are overwritten as described when the form is processed.

How is the +nowdate placeholder set?

Could you post your full NP tag?

And also the exact pagetitle and menutitle results you’re seeing in the NP form.

I tried +nowdate based on this post. It has done fine for setting the pagetitle value?

Here’s the full call, with the captions param omitted because its contents are extensive:

 [[!NewsPublisher?
    &initrte=`1`
    &initDatePicker=`1`
    &initfilebrowser=`1`
    &published=`1`
    &hidemenu=`0`
    &aliastitle=`0`
    &cssfile=`c_newspublisher.css`
    &template=`3`
    &parentid=`6`
&show=`pagetitle,,menutitle,dayRank,whyRank,didWell,notWell,realizedToday,performanceTag,nextSteps,marketSummary,images,chartCaption,chartTag,chartNotes,content`
&presets=`pagetitle:daily-sheet-[[!+nowdate:default=`now`:strtotime:date=`%Y-%m-%d`]],menutitle:Daily Sheet [[!+nowdate:default=`now`:strtotime:date=`%m-%d-%y`]]`
      &outertpl=`c_npOuterTpl-daily`
      &optionoutertpl=`c_npOptionOuterTpl`
      &optiontpl=`c_npOptionTpl`
      &tinymceinittpl=`c_npTinymceInitTpl`
      &richtexttpl=`c_npRichtextTpl`
      &datetpl=`c_npDateTpl`
      &usetabs=`1`
      &activetab=`Rankings`
      &tabs=`{
        "Rankings" :        ["pagetitle","menutitle","dayRank","whyRank"],
        "Self Assessment" : ["didWell","notWell","realizedToday","performanceTag"],
        "Action Items" :    ["nextSteps"],
        "Market Notes" :    ["marketSummary","images","chartCaption","chartTag","chartNotes","content"]
        }`  
 ]]

I can’t reproduce this behaviour.

  • If you use no &presets at all, is the menutitle also overridden by the value of the pagetitle when you save the form?
  • Open the “Network” tab of the browser’s developer tools before you save the form. Check the form-data in the request. Is the value correct for the fields pagetitle and menutitle?
  • Can you reproduce the same behaviour with a much simpler setup (maybe on a test installation of MODx)?
[[!NewsPublisher?
    &show=`pagetitle,menutitle,content`
    &presets=`pagetitle:daily-sheet-[[!+nowdate:default=`now`:strtotime:date=`%Y-%m-%d`]],menutitle:Daily Sheet [[!+nowdate:default=`now`:strtotime:date=`%m-%d-%y`]]`
    &template=`3`
]]

Also –

&show=`pagetitle,,menutitle, ...

That double comma is a mistake.

Thanks - that a typo is from copy / paste. It’s not in the actual call.

With presets removed entirely, values provided for menutitle are still overwritten after processing on the existing call that I shared.

The post data is correct – values provided for pagetitle and menutitle both are posted as submitted.

With the setup you provided, the form does not process at all when &preset includes +nowdate in either pagetitle or menutitle, so the use of +nowdate seems to be the culprit.

You said that you have the same behaviour with presets removed entirely, so +nowdate can’t be the culprit.

Maybe you have now 2 resources with the same pagetitle (and therefore the same alias), so the form won’t save.

Do you have SiteCheck? That would tell you if you have duplicate aliases or invalid parents.

If you don’t find any duplicates, you might try replacing that whole nowdate tag with a snippet.

[[!myDate]]

With code something like this:

/* myDate snippet */
return date('m-d-y');

I don’t on this site, but great idea. I’ll ‘buy’ a new copy.