@Thisname and @Thisvalue don't work in HTML Attributes

Functions @Thisname and @Thisvalue don’t work in the field’s HTML Attributes property.I assumed I could use @Thisvalue to determine which class to set for a field when displaying an existing document in Edit mode on web, but these functions don’t work in the field’s HTML Attributes property. They work perfectly fine when used in Input translation or Input validation properties.

Example: @If(@ThisValue = “”; " class="error\ " ; “”)

will generate class=“error” for any field value.

There is no restriction mentioned in the Designer documentation.

Does anyone know of any solution to get around this?

Eva

Subject: Try this

The online help is pretty clear you can’t use a formula:

“An HTML attributes formula attaches HTML attributes to a field for use in Web applications.An HTML attributes formula should be a text constant.”

So try setting the class at runtime e.g. in the onLoad event:

if (document.forms[0].YourField.value == “”)

{

document.forms[0].YourField.className = “error”;

}

else

{

document.forms[0].YourField.className = “”;

}

Subject: @formula in HTML attributes

Actually, you are allowed to use @formula when creating the HTML attributes, but the result must be a text constant.My @formula is more complicated than the first example. I need to use it in many editable fields, so I tried to copy this to all fields:

@If(@Thisvalue= @GetField(“def” + @Thisname) ; defaultFieldEvents; FieldEvents );

where defaultFieldEvents and FieldEvents are two “Computed for display” fields on my form.

It works if I change the formula to:

var := “FirstName”;

@If(@GetField(var)= @GetField(“def” + var) ; defaultFieldEvents; FieldEvents );

The think is, I have to set the local variable “var” for each field instead of having same code in all the HTML attributes.

/Eva