SWS001
asked on
Livecycle Validation - Getting a Textfield substring
Hi,
Have a problem with validation using Javascript in Adobe LiveCycle Designer.
I have a textfield that I want to accept up to 12 characters, or 13 characters if preceded by a + or - symbol. I can set a maxChars on the field, but that only works for 12 or 13. I was thinking of setting the maxChars attribute with the onchange event, so if the first text char is a + or - then set maxChars to 13, otherwise set to 12. Something like
if (this.rawValue.substring(0 ,1) != "+" && this.rawValue.substring(0, 1) != "-") {
//app.alert ("starting with + or -!");
Somehow set maxChars to 12
} else {
//app.alert ("NOT starting with + or -!");
Somehow set maxChars to 13
}
this.rawValue.substring doesn't work, despite being valid JS afaik
this.rawValue alone doesn't have the currently typed in value, only the value that was in the TextField after the last time you exited it
It might be that we have to use FormCalc etc, but I don't really want to go that route if possible.
Thanks
Have a problem with validation using Javascript in Adobe LiveCycle Designer.
I have a textfield that I want to accept up to 12 characters, or 13 characters if preceded by a + or - symbol. I can set a maxChars on the field, but that only works for 12 or 13. I was thinking of setting the maxChars attribute with the onchange event, so if the first text char is a + or - then set maxChars to 13, otherwise set to 12. Something like
if (this.rawValue.substring(0
//app.alert ("starting with + or -!");
Somehow set maxChars to 12
} else {
//app.alert ("NOT starting with + or -!");
Somehow set maxChars to 13
}
this.rawValue.substring doesn't work, despite being valid JS afaik
this.rawValue alone doesn't have the currently typed in value, only the value that was in the TextField after the last time you exited it
It might be that we have to use FormCalc etc, but I don't really want to go that route if possible.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.