cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Validating a string in a paragraph

rboneti
1-Newbie

Validating a string in a paragraph

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?


1 ACCEPTED SOLUTION

Accepted Solutions
rdiaz
5-Regular Member
(To:rboneti)

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:

check4.png

Here, we see the new context, and we can modify the element to have content hidden:

check5.png

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:

check6.png

View solution in original post

6 REPLIES 6
rdiaz
5-Regular Member
(To:rboneti)

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!

rboneti
1-Newbie
(To:rdiaz)

Thank you Rafael!

I think the 3th option is the better than others... Can you give me more details?

rdiaz
5-Regular Member
(To:rboneti)

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

check1.png

2) After that, in the element, click the gentext tab, and modify the gentext:

check2.png

3) Resulting element in the Editor would be:

check3.png

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.

rboneti
1-Newbie
(To:rdiaz)

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>

rdiaz
5-Regular Member
(To:rboneti)

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:

check4.png

Here, we see the new context, and we can modify the element to have content hidden:

check5.png

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:

check6.png

rboneti
1-Newbie
(To:rdiaz)

Thank you again... Now it works!

Top Tags