Knowledge Partner
Knowledge Partner
166 views

UserApp form field validation without messages

This seems like it should be simple, but I'm drawing a blank here. In a simple PRD form, I want to validate my inputs. If the field is "wrong", I want to error the field, both to highlight the error, and to disable the submission of a form with an error. Seems like form.showError() is a natural fit here, but I do not want it to show a message. So this:

v=field.getValue();

if (v.length == 1) // whatever
{
form.showError(".");
}
else
{
form.clearMessages();
}

works - but with the "Field Name: ." shown at the top of the form. I don't want that. Just invalidate the field. Whatever form.showError() does to invalidate the field, but without the message part.

 

Labels (1)
0 Likes
2 Replies
rrawson Honored Contributor.
Honored Contributor.

Re: UserApp form field validation without messages

You could try using jQuery to hide the message.
0 Likes
Knowledge Partner
Knowledge Partner

Re: UserApp form field validation without messages

Possibly. I'm thinking I shouldn't have to hide it. form.showError() is clearly doing three things. It marks the field contents as "invalid" (turns red). It marks the form as "invalid" (blocks Submit). And it displays a message. I want to do only two of those things.

I can disable the Submit button, I know how to do that. It seems like it should be simple, even obvious, how to mark a form field as "invalid".
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.