Hello Shamil,

Wednesday, September 27, 2000, 4:13:31 PM, you wrote:

SY> Hi,

SY> I've just tried to use FormMessages routine.

SY> In FormMessages.java in the class description it is stated that
SY> it allows to query for messages by form name and field name.

SY> But there is no possibility to get messages by form name and field name.

SY> There is only one method:

SY> public FormMessage[] getFormMessages(String formName)

SY> which returns messages for a given form.

SY> I guess there should be something like this:

SY> public FormMessage[] getFormMessages(String formName, String fieldName)


Below is the patch that solves this.

/ Shamil



--- FormMessages.java.orig  Sat Sep  2 05:11:28 2000
+++ FormMessages.java Mon Oct 16 15:21:06 2000
@@ -198,6 +198,35 @@
     }
 
     /**
+     * Get form messages for a given form and field. 
+     *
+     * @param formName A String with the form name.
+     * @param fieldName A String with the field name.
+     * @return A FormMessage[].
+     */
+    public FormMessage[] getFormMessages(String formName, String fieldName)
+    {
+        String key = formName + "-" + fieldName;
+
+        Vector messages = getValues(fields_messages, key);
+        String messageName;
+
+        if (messages != null)
+        {
+            FormMessage[] result = new FormMessage[messages.size()];
+            for (int i = 0; i < messages.size(); i++)
+            {
+                result[i] = new FormMessage( formName, fieldName );
+                messageName = (String) messages.elementAt(i);
+                result[i].setMessage( messageName );
+            }
+            return result;
+        }
+        return null;
+    }
+
+
+    /**
      * Check whether a form as a field.
      *
      * @param formName A String with the form name.




------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to