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)
dct allowed option
rodigz
Hi ,
I'm using TS 6.5 , I tried to use the allowed for items.. Instead of showing radio buttons invisible it is showing textarea.
Any idea?
<item name="Test">
<label>Label Radio</label>
<radio required="t">
<option value="3" label="Three" />
<option value="1" label="One" />
<option selected="t" value="0" label="None"/>
<allowed>
<not>
<cred role="author"/>
</not>
</allowed>
</radio>
</item>
Find more posts tagged with
Comments
JonathonG
You need to add a "default" item type for when the allowed fails:
<item name="Test">
<label>Label Radio</label>
<radio required="t">
<option value="3" label="Three" />
<option value="1" label="One" />
<option selected="t" value="0" label="None"/>
<allowed>
<not>
<cred role="author"/>
</not>
</allowed>
</radio>
<hidden/>
</item>
Jonathon
Interwoven Developer
Allstate, Inc.
rodigz
thanks for reply. Jonathon
default value??
I tried to used hidden also but I'm using formapi to validate the fields.
I use the IWItem.isValid() to validate if is require or not. In 5.5.2 works fine but in 6.5 if it is hidden it will still validate.
jbonifaci
By default value he means one that will apply to the item if the item types with the allowed elements do not meet the appropriate criteria. If you see his example, the first item type is radio and will only show up for those that are not authors. The second item type is hidden and has no allowed element and therefor will be the "default" if the user does not meet the special criteria for the other item types for this item. So in his example, the item "Test" will show up as a hidden item for authors, but as radio buttons for everyone else. This is just an example, you should be able to use the theory behind it to accomplish your goal.
~Jeff
rodigz
hi jeff,
Yes I understand the logic of the allowed my concern is the rendering of it in ts 6.5. In 5.5.2 if is not allowed field there will be field available but in 6.5 the readonly field is textarea. I speciy radio I should expect radio readonly.
On the second point the hidden field. As I mentioned I've using to formapi to validate required field. I've used IWItem.isValid () in 5.5.2 it works finw it will not validate required field hidden but in 6.5 it will validate hidden values.
jbonifaci
You don't need to have the default item type be hidden, you can make it whatever you like, Jonathon only chose that as an example. You can have the default item type be radio just as easily, it's up to you what it is.
~Jeff
rodigz
i appreciate your response. See attached file
jbonifaci
I understand that. All you need to do is add another radio element in your Test1 item without any allowed credentials below the one you already have. This second radio element will be used when the user does not meet the allowed credentials of the first radio element.
~Jeff
rodigz
hi jeff,
If saw the screen shot the readonly is texarea eventhough I defined radio. I want the readonly radio.
regards
jbonifaci
I assume you are logging in as an author when you see the text area? When you log in as an author, it skips the radio item type you defined because it is not allowed for authors. Because you have no default item type defined, it picks it's own default, which is a text area. As Jonathon said, you need to define a default:
<item name="Test">
<label>Label Radio</label>
<radio>
<option value="3" label="Three" />
<option value="1" label="One" />
<option value="0" label="None" selected="t" />
<allowed>
<not>
<cred role="author" />
</not>
</allowed>
</radio>
<radio>
<option value="4" label="Four" />
<option value="5" label="Five" />
<option value="6" label="Six" />
</radio>
</item>
Let me know if you are still confused about how allowed works.
~Jeff
rodigz
~Jeff
I understand the finctionality how it works. I'm concerned on the output/cosmetic part. See attached file output difference in 5.5.2 and 6.5.
It should not display texatarea in 6.5 it is confusing to the users. I will say no enter data something.
thanks!
jbonifaci
The change in functionality is that readonly items now show up as disabled instead of as just plain text. In your case I would recommend you either:
1) Do as Jonathon suggested and have your 2nd item type be hidden, that way the item will not show up for authors.
2) Instead of having your second item type be hidden, have it be readonly with a default friendly message.
3) Don't use allowed at all. In your formapi, check to see if the users role is author and if so set the item to readonly.
~Jeff
rodigz
ok thanks.
jkm
Hi,
If I am setting my field to readonly then I cannot see default value in my field. I am on TS6.5 + DTD 5.0 + Sun OS
and here is my DCT entry
<item name="HEADING">
<label>Heading</label>
<database data-type="VARCHAR(20)" />
<readonly/>
<text required="t" maxlength="20" >
<default> This is default Text </default>
</text>
</item>
Am I doing something wrong or this is the way it works ?
jkm
Any clues or assistance on this please ??
jbonifaci
You have two item types declared. The default is only for the text item type. Because the hidden item type is being used, there is no default value for it. You must move the default value within the hidden tag.
~Jeff
Adam Stoller
Jeff - I think you meant readonly where you said hidden - yes?
In my experience - readonly and hidden are *best* handled by FormAPI after the form has loaded, as opposed to specifying them statically within the DCT. It *should* work correctly from the DCT, but most of the time it seems to work better (if not 'only') through the use of FormAPI.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
jkm
Thanks guys for your replies. I want to set a default value and make that field readonly. As Adams has suggested I will go with formAPI to make the fields readonly on load of form.
Sometimes its good to have experienced advices like this rather than trying for sometime and make your conclusions
jbonifaci
Yeah, that's what I meant. I was a little burnt out from all of the holiday travel.
I agree that the best place to set hiddens is in FormAPI, but I was just explaining why his default value didn't show up.
~Jeff