<![CDATA[ Newspublisher doesn't create new resource - My Forums]]> https://forums.modx.com/thread/?thread=97637 <![CDATA[Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528049 My Newspublisher call is on resource with ID=40 :
[[!NewsPublisher?
&show=`pagetitle,VerDatum,VerPloeg,VerThuisploeg,VerUitploeg,VerUitslag,VerSoortWedstrijd,VerVerslagTekst` 
&initrte=`1`
&rtcontent=`1`
&initdatepicker=`1`
&listboxmax=`1`
&templateid=`7`
&parentid=`41`
]]

As you can see I have a lot of template variables.
The new resource must be created under resource with ID=41, and must use template with ID=7.
The variables are assigned to the template with ID=7.

When I go to the Newspublisher resource, it shows the form, and I can fill in all the fields/variables, but when I hit "Submit" it comes back to the form and nothing is created.

When I leave out the &show line in the Newspublisher call, I get the standard form in Newspublisher and the resource is created at the right place with the right template!
But as soon as I use &show it goes wrong. And I need the &show to use my template variables.

Anyone can help ?

Modx version : 2.3.3
Newspublisher : 2.1.0]]>
bendy4 Jul 08, 2015, 08:43 AM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528049
<![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528299 Great to get this help as a novice here.]]> bendy4 Jul 15, 2015, 01:59 AM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528299 <![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528175
NewsPublisher sends the TV values to the resource/create processor, but unfortunately, AFAIK, they're not in the array sent to the System Events, so you have to get them from the DB.]]>
BobRay Jul 10, 2015, 03:57 PM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528175
<![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528174 Quote from: bendy4 at Jul 10, 2015, 07:07 AM
I want the pagetitle to be altered based on the values that the user entered in the TV's.

@BobRay, in his case, do the TVs have values already in the MODx DB, or are they going to have their value for the first time when he submits the form?
Or upon saving, are the TVs registered before the pagetitle? - I am not even sure I am making sense to myself.
I am in wonder how MODx works here.]]>
donshakespeare Jul 10, 2015, 03:53 PM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528174
<![CDATA[Re: Newspublisher doesn't create new resource (Best Answer)]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528169
$value1 = $resource->getTVValue(12);
$value2 = $resource->getTVValue(22);
$resource->set('pagetitle', $value1 . $value2);
$resource->save();
return '';


There are some ways to speed this up, but since it won't affect page-load speeds, they're probably not worth the trouble.
]]>
BobRay Jul 10, 2015, 03:37 PM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource?page=2#dis-post-528169
<![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528148 I was thinking that it must be done before saving the resource, like you suggest.
But I've never written any plugin because I'm fairly new to modx revolution, so this is a difficulty for me.
Can you please show me an example of such a plugin ?
]]>
bendy4 Jul 10, 2015, 02:07 AM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528148
<![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528137
If you want to alter the pagetitle of the new resource on the basis of the TV values set by the user, you should be able to do it in a plugin attached to the OnDocFormSave event, though using JS to alter the pagetitle immediately based on them is also an option. If you want to alter the pagetitle shown when the form comes up on the basis of the default values of the TVs, JS would be your only option.]]>
BobRay Jul 09, 2015, 07:03 PM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528137
<![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528125 In the Newspublisher form the template variables are filled in, and in the new created resource they are displayed.
In the pagetitle of the new created resource I want some of those template variables.

Pagetitle is not the only field with an input[type=text], there are also template variables with input[type=text]]]>
bendy4 Jul 09, 2015, 05:25 PM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528125
<![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528124
If your TV values are not in the browser, that is another question.

Question:
Is pagetitle the only field with an input[type=text] that you specified in NewsPublisher?
If so, you can duplicate npTextTpl, and do some magic in the value of the input way before it hits the browser.]]>
donshakespeare Jul 09, 2015, 05:03 PM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528124
<![CDATA[Re: Newspublisher doesn't create new resource]]> https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528120
Is it possible to set the pagetitle of the new resource, that is created by Newspublisher, to a concatination of some of the template variables?
example : after hitting the submit button in Newspublisher I want the pagetitle to be VarPloeg VarDatum.

Searched the forum and found this tread : http://forums.modx.com/thread/?thread=31326&page=1, but this is to difficult to understand for me as novice user of modx.

Anyone can help ?]]>
bendy4 Jul 09, 2015, 03:59 PM https://forums.modx.com/thread/97637/newspublisher-doesn-t-create-new-resource#dis-post-528120