I m trying to put a validation on a text field.I want to restrict the max no of character entered upto 50...user should get the alert message as he/she crosses the limit while entering the data.i.e. before the item change as well as form save events.Is there any other way to achieve this w/o using keyup events and setting the maxlength attribute...the alert message is a must requirement.Thanks
Thanks for the help..i think description element will solve the purpose.can anyone suggest me how can i set the maxlength attribute dynamically.i.e. i will read the length of that attribute from the database and set it as maxlength attribute for that element at DCT at the time of form load.Thanks
In your DCT under data-capture-requirements call inline command and then in the perl file write watever the thing you want to write. inline command line can be used for to populate a field dynamically or to create a DCT dynamicallyIf you use the second approach then your problem will resolve.
ya Mr.Ghoti is exactly correct.. i m looking to alter the maxlength attribute dynamically. Actly as i told earlier my requirement is to match the length of a DCT field with the length of database field.Thanks for the help...
The inline command is processed prior to form initialization and therefore cannot be used to dynamically alter the form after it has already been rendered - which I believe is what ShaileshM is looking for.No - there is no supported FormAPI mechanism for adjusting the maxlength of a text field dynamicall.You could, potentially, do this with "raw" javascript code - but I'm not 100% sure of "how" nor whether it will actually work.I do have to wonder why you wouldn need to dynamically alter the maxlength of a text field dynamically though - it sounds suspiciously like you're trying to design a one-size-(doesn't)-fits-all DCT.
Adam, Please see the attached DCTs to achieve what I wrote above.
But if all you're doing is trying to set the max length of the field to a set value from the database, you can do this with an inline. Just have the inline return the proper max length attribute for the item based on this value in the database.
in your example a DCT is being callled by an ipl. But the DCT is still hard coded.What my requirement is to set the maxlength dynamically i.e. on form load.The main issue is to set the value as maxlength attribute of an item.i.e. if we have the value..how can we set it on form load...