Hi All,

Looking for the solution. Given class, implements RunAction2 and has a 
Descriptor.
In its index.jelly I  have a form which I want to validate. It's pretty 
much the same as this 
<https://www.youtube.com/live/azyv183Ua6U?feature=share&t=2368> example 
except in my case the form is in an Action, not in a Builder. 

index.jelly:
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" 
xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" 
xmlns:f="/lib/form">
    <l:layout title="Mark this build as release">
        <l:main-panel>
            <st:contentType value="text/html;charset=UTF-8"/>
            <st:bind var="backingClass" value="${it}"/>
                <f:form action="submit" method="get" 
name="release-build-form">
                    <f:entry title="Comments" field="comments">
                        <f:textbox/>
                    </f:entry>
                    <f:entry>
                        <f:checkbox name="release" 
value="${it.isBuildMarkedAsReleaseBuild}" title="Is this build release?"/>
                    </f:entry>
                    <f:submit/>
                </f:form>
        </l:main-panel>
    </l:layout>
</j:jelly>

My problem is, doSubmit() is called before any validation would happen. I 
tried to add the following method to my *descriptor *but it is *not *called.

public FormValidation doCheckComments(@QueryParameter String comments) {
            if (comments == null) {
                return FormValidation.error("Comments is missing");
            }
            if (comments.isBlank()) {
                return FormValidation.error("Supply a non empty comment.");
            }
            return FormValidation.ok();
}

Any ideas?

Tamas

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/47472549-2334-4dbc-8c0c-5b0c409e2d0en%40googlegroups.com.

Reply via email to