I have a form in which a user can select the type of text input field that they would like to use (based on the available text input type fields that the clientside validation model supports - let's call this textfield A). Also on that page is another textfield (B) that permits a user to enter a default answer to be display in textfield A.
The problem I am having is that when the textfield type is select (say numeric values only), I would like the textfield B implement the selected validation rule and verify that the text in that field is indeed all numeric. Likewise if I change type to email that textfield B's validation rule updates and checks that the enter text conforms to the new rule.
Currently what I have set up is that when a text input type is selected an new textfield B is created with the new validation rule and the text (if entered) from the previous textfield entered as the default answer (this is done through AJAX calls and a custom module). The problem is that when the answer is validated, it is still using the original validation rule (regardless of how many times I select a different validation rule). It almost seems like the clientside javascript never gets updated. I am wondering if anyone has experienced this before and how one would go about fixing it?
Thanks.
PS I am using Drupal 7 and clientside validation module (both latest versions).
FAPI #states
to enable or disable validation rules or change them. But, I doubt it.