The API objects wiki page says getAttrByName() Gets the value of an attribute, using the default value from the character sheet if the attribute is not present. This only seems to be behaving reliably when type is a number, and is NOT in a repeating section. Specifically, if you have Age: <input name="attr_Age" type="number" value="21" > And you don't change Age, it will return a 21. If you do change Age it will correctly return the value changed to. This is the only case I have found where getAttrByName() works as advertised. If you have a dropdown list such as <select name="attr_Questor" style="width:9em;">
<option value="0" title="None."> None</option>
<option value="1" title="Love, Arts, Music.">Astendar </option>
<option value="11" title="Building, Construction, Planning.">Upandal </option>
<option value="12" selected title="Manipulation, Deceit.">Vestrial (Mad) </option>
<option value="13" title="(Optional)">Death </option>
</select>
Then if the user has set a value, the value will be returned. Otherwise (if it is still showing the default value) getAttrByName() returns an empty string (""); Things are different (worse) if you are attempting to display something within a repeating section. log( getAttrByName( cID, "repeating_discipline_-KLq7eIGgjhop-ZQIjTY_Discipline-Name"));
log( getAttrByName( cID, "repeating_discipline_-KLq7eIGgjhop-ZQIjTY_Age3"));
displays fine if the values (in the case above a select statement and a number) have been changed from their default values. If they have not then in both cases the console log shows an error message similar to the following. "Error: No attribute or sheet field found for character_id -KLq7_XpU43TB22AFc9g named repeating_discipline_-KLq7eIGgjhop-ZQIjTY_Age3"
and the log shows that getAttrByName is returning a value of undefined. So once again the documentation says it returns the default value. That only happens when type is number and it is not in a repeating section. For select statements not in a repeating section it returns an empty string. For numbers or select statements inside a repeating section it displays an error in the console log and returns undefined.