"contentid may not be null" when automatically copying a value from another field

I am getting the following when I try to set the ‘default value’ for a field to be the value of another field on the same piece of content:

<PSXLogErrorSet class=“Back end update processing” host=“eqcmsdev01.eq.fool.net” port=“9992” protocol=“http” root="/Rhythmyx" rxroot=“http://eqcmsdev01.eq.fool.net:9992/Rhythmyx”>

<Error id=“0”>
An error occurred processing the update submitted by session id f93974a270968c51282b1389311f92d051536329.

<Error id=“1”>
java.lang.RuntimeException: contentid may not be null
<Error id=“2”>modify</Error>

I selected the other field by clicking ‘other value…’ and selecting Content Item Data and then selecting the field I wanted to use. Both fields are local to this single content type. Any ideas?

I got the same kind of error message. I’d like to fill the callout field with the description value by default.

You get that error because the ‘Content Item Data’ value causes the server to attempt to open an item whose contentid was specified by sys_contentid. Since this is not provided on a new instance, you get the exception noted.

Generally, ‘Content Item Data’ should not be used in the context of a content type because it will usually cause infinite loops (in your case, you got lucky and only got an exception.)

The order of processing of fields is not defined, so what you are trying to do is not a good practice as it may work one time, but not another, depending on which order the fields were processed. You are better off setting the same default value on both fields rather than on one and referencing it.

Another approach would be to set the value on submit if the field was empty. You would use a field transform for this.

How would you use a field transform in that way? I assume it would be an input transform and the Transform type would be “Set Field”. What is the JEXL syntax for retrieving the value of another field?



So, how do you reference the field’s value, if not via ‘Content Item Data’? I’m getting the same error message because attempted to validate the img2_width field using a validation type of Conditional, with a condition of:

PXSContentItemData/img2_width < 91

I could do this using the Number Range validation type, but I want to add more conditions (see http://forum.percussion.com/showthread.php?t=1088)

I’ve tried $value, which is how you reference the current field’s value when using JEXL validation type.




In the value selector, choose the ‘Single Html Parameter’ type and enter the name of the field (img2_width in this case.)

Thank you very much, that works for me.

I’m still interested in copying a value from another field, not necessarily validating it. Specifically, I want to put the Description into the Callout field if the content creator leaves it blank. Would it work to use an input transform with the Transform type “Set Field”, to set the value on Submit if the field is empty? What JEXL expression could I use? Or is there a better way to do this?

No, that won’t work. You would have to create a UDF extension and use that as the Input Transform. The extension should take the name of the source field and the ‘default’ value. It would check if the source field value is empty and if so, set the supplied default value on the source field.

Another approach is to set the default value when the item is initially created. This allows the user to see the default and either accept it or replace with the text they desire. I think this is a better approach as it is explicit rather than implicit.

Well, I’ll try that. I see that you discussed a UDF solution in http://forum.percussion.com/showthread.php?t=592.