You can format field values by adding ASP code.
The input value is stored in the variable value. The output value is assigned to the same variable value. You can access other fields of the same data record as data["FieldName"].
If you chose Lookup wizard in the "Edit as" settings, use value to access the Display field value and data["LinkFieldName"] to access the Link field value.
Examples
1. Convert a string into the upper case:
strValue = Ucase(strValue)
2. Format a 10-digit phone number into the following format (xxx) xxx-xxx:
if Len(strValue)=10 then
strValue = "(" & Mid(strValue,1,3) & ") " & Mid(strValue,4,3) & "-" & Mid(strValue,7)
end if
3. Display the value of the field FirstName as <FirstName> <LastName> (if the LastName field defined):
strValue = strValue & " " & data("LastName")
4. Display a number in black if the number is positive, and in red if the number is negative:
if CDbl(strValue)>0 then
color="black"
else
color="red"
end if
strValue= "<font color='" & color & "'>" & strValue & "</font>"
5. Display a field containing email address as an email hyperlink (mailto function used). The value of subject in mailto function is set to a value of another field:
strValue = "<a href='mailto:" & strValue & "?subject=" & data("SubjectField") & "'>Send email</a>"
6. Display a field value in one line (without line breaks):
strValue = Replace(strValue, " "," ")
7. Display all images uploaded via multiupload:
if Len(strValue)>0 then
doAssignmentByRef filesArray,my_json_decode(strValue)
allItems = filesArray.Items
imageValue = ""
For i = 0 To filesArray.Count - 1
imageValue = imageValue & "<img alt='" & htmlspecialchars(allItems(i)("usrName"))&"' src='" & htmlspecialchars(allItems(i)("name"))&"'>"
Next
strValue = imageValue
end if
8. Display a phone number as a click-to-call link for mobile browsers:
strValue = "<a href='tel:" & strValue & "'>Call us!</a>"
See also:
•How to create a custom Edit control plugin