Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Dear Arbortext users,
I constructed a form in the arbortext editor and I need to do a validation in a field. The only one caractere the user may type is "X" or leave empty. How can I do this validation?
Solved! Go to Solution.
If you need it to be based on content, it's just as simple as creating a new context for the element.
Below you can see I'm in the process of adding a new context for the citation element.
Select 'New Content Test' instead of 'Attribute Test', and have the check simply be for any content:
Here, we see the new context, and we can modify the element to have content hidden:
Now just add the desired gentext as normal. Note, in the Editor view, you will see both the content typed, and the gentext (if it is turned on), but in composed output, you will only see the gentext:
Hi Robson,
There's a few variables here, so I'm not certain about your workflow and how you want this implemented. If the form is to be filled out in the composed output (like a PDF form or HTML form), that would require one approach, whereas if the users are entering the data in Editor itself, it completely different.
In the latter, you have several options:
1) The most complicated one would be to use ACL, in which case you would need a hook to watch for this event and return when invalid entries are made
2) Starting with Editor 6.0 and up, you could use a schematron to validate your fields, but that requires the user, or someone else, to run a Completeness Check to see the errors.
3) You could just have the 'X' value set as gentext, tied to an attribute value. This way, whatever the user types into that attribute field, only an 'X' is displayed.
Let me know if any of these are what you were looking for, or if you were thinking another direction. Thanks!
Thank you Rafael!
I think the 3th option is the better than others... Can you give me more details?
Robson, this should be doable in a few short steps:
1) Create a context for the attribute being used. In my example, I am using the <tip> element, and creating a context where If attribute 'vendor' is assigned any value
2) After that, in the element, click the gentext tab, and modify the gentext:
3) Resulting element in the Editor would be:
As an additional step, you can also set other content in that element as hidden, in case users do type something in, then in composed output it would not be seen. Or, even better, you can set the element itself as not accepting text in the DTD, and still insert gentext as above.
Hope this helps.
Thank you Rafael!
I applied this solution, and the 'X' appears like you showed me. But, I need to compare the element content, and not the attribute.
Example:
The user types 'A': <tip>A</tip>
I need to change the 'A' to 'X': <tip>X</tip>
If you need it to be based on content, it's just as simple as creating a new context for the element.
Below you can see I'm in the process of adding a new context for the citation element.
Select 'New Content Test' instead of 'Attribute Test', and have the check simply be for any content:
Here, we see the new context, and we can modify the element to have content hidden:
Now just add the desired gentext as normal. Note, in the Editor view, you will see both the content typed, and the gentext (if it is turned on), but in composed output, you will only see the gentext:
Thank you again... Now it works!