Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Default Hidden Value in DCT
dlukezic
Is there a way to create a hidden field on a DCT AND give it a value? Or do I have to do this in a corresponding .js file?
Thanks,
Doreen
Find more posts tagged with
Comments
Adam Stoller
I
think
it would be something like this:
<item name="hidden_field">
<hidden/>
<text>
<default>xyz</default>
</text>
</item>
(haven't verified this myself - sorry)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
dlukezic
Thanks for the idea, but it's not working for me. The value tag is empty when the dcr gets saved.
Any other thoughts?
Thanks!
Doreen
Adam Stoller
If that doesn't work - then using FormAPI to hide the field may be the only recourse. You put code in your DCT like previously shown - just leave out the <hidden> tag - and then you have your init() function explicitly hide the field.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Migrateduser
You are better off doing this in the .js file because you have more logic there. For instance, if you use the DCT default tag, only new DCRs will get that default. If you do it in .js you can have logic such as if the field is empty give it the default. I would go with the .js because it's more flexible if requirements change, it's not much harder and in some ways it's more clear.
I seem to remember some bugs with hidden and readonly and default text, not sure if these apply to your version.