Jelly tag for hidden jelly tag

4 messages Options
Embed this post
Permalink
Sankaran, Nambi

Jelly tag for hidden jelly tag

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi Kohsuke
 
The standard jelly tags in hudson only have textbox and password.
One of our plugins require a html input of type "hidden".
So, we created a "textboxhidden.jelly" and stored it under src/main/resources/lib/form in the plugin project.
It works fine, when we run "hpi:run".
But it doesn't work when we use the plugin with the hudson war file.
Why is that?
 
Also, how to create custom jelly tags that can be used by a set of plugins?
 
This is the "textboxhidden.jelly" file.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:f="/lib/form">
  <st:documentation>
    Generates an input field <tt>&lt;input type="text" ... /></tt> to be
    used inside &lt;f:entry/>

    <st:attribute name="field">
      Used for databinding. TBD.
    </st:attribute>
    <st:attribute name="name">
      This becomes @name of the &lt;input> tag.
      If @field is specified, this value is inferred from it.
    </st:attribute>
    <st:attribute name="value">
      The initial value of the field. This becomes the @value of the &lt;input> tag.
      If @field is specified, the current property from the "instance" object
      will be set as the initial value automatically,
      which is the recommended approach.
    </st:attribute>
    <st:attribute name="default">
      The default value of the text box, in case both @value is and 'instance[field]' is null.
    </st:attribute>
    <st:attribute name="checkUrl">
      If specified, the value entered in this input field will be checked (via AJAX)
      against this URL, and errors will be rendered under the text field.

      If @field is specified, this will be inferred automatically,
      which is the recommended approach.
    </st:attribute>
  </st:documentation>
  <f:prepareDatabinding />
  <input class="setting-input ${attrs.checkUrl!=null?'validated':''}"
         name ="${attrs.name ?: '_.'+attrs.field}"
         value="${attrs.value ?: instance[attrs.field] ?: attrs.default}"
         id="${attrs.id}"
         type="hidden"
         checkUrl="${attrs.checkUrl}" checkMethod="${attrs.checkMethod}"
         onchange="${attrs.onchange}" onkeyup="${attrs.onkeyup}"/>
</j:jelly>
thanks
Nambi
 
Sankaran, Nambi

RE: Jelly tag for hidden textbox

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Correcting the subject " Jelly Tag for hidden textbox


From: Sankaran, Nambi [mailto:[hidden email]]
Sent: Monday, October 12, 2009 2:19 PM
To: [hidden email]
Cc: [hidden email]
Subject: Jelly tag for hidden jelly tag

Hi Kohsuke
 
The standard jelly tags in hudson only have textbox and password.
One of our plugins require a html input of type "hidden".
So, we created a "textboxhidden.jelly" and stored it under src/main/resources/lib/form in the plugin project.
It works fine, when we run "hpi:run".
But it doesn't work when we use the plugin with the hudson war file.
Why is that?
 
Also, how to create custom jelly tags that can be used by a set of plugins?
 
This is the "textboxhidden.jelly" file.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:f="/lib/form">
  <st:documentation>
    Generates an input field <tt>&lt;input type="text" ... /></tt> to be
    used inside &lt;f:entry/>

    <st:attribute name="field">
      Used for databinding. TBD.
    </st:attribute>
    <st:attribute name="name">
      This becomes @name of the &lt;input> tag.
      If @field is specified, this value is inferred from it.
    </st:attribute>
    <st:attribute name="value">
      The initial value of the field. This becomes the @value of the &lt;input> tag.
      If @field is specified, the current property from the "instance" object
      will be set as the initial value automatically,
      which is the recommended approach.
    </st:attribute>
    <st:attribute name="default">
      The default value of the text box, in case both @value is and 'instance[field]' is null.
    </st:attribute>
    <st:attribute name="checkUrl">
      If specified, the value entered in this input field will be checked (via AJAX)
      against this URL, and errors will be rendered under the text field.

      If @field is specified, this will be inferred automatically,
      which is the recommended approach.
    </st:attribute>
  </st:documentation>
  <f:prepareDatabinding />
  <input class="setting-input ${attrs.checkUrl!=null?'validated':''}"
         name ="${attrs.name ?: '_.'+attrs.field}"
         value="${attrs.value ?: instance[attrs.field] ?: attrs.default}"
         id="${attrs.id}"
         type="hidden"
         checkUrl="${attrs.checkUrl}" checkMethod="${attrs.checkMethod}"
         onchange="${attrs.onchange}" onkeyup="${attrs.onkeyup}"/>
</j:jelly>
thanks
Nambi
 
Kohsuke Kawaguchi

Re: Jelly tag for hidden jelly tag

Reply Threaded More More options
Print post
Permalink
In reply to this post by Sankaran, Nambi
Sankaran, Nambi wrote:
> Hi Kohsuke
>  
> The standard jelly tags in hudson only have textbox and password.
> One of our plugins require a html input of type "hidden".
> So, we created a "textboxhidden.jelly" and stored it under
> src/main/resources/lib/form in the plugin project.
> It works fine, when we run "hpi:run".
> But it doesn't work when we use the plugin with the hudson war file.
> Why is that?

I believe this is fixed now, but I don't think this tag makes sense, as
a hidden textbox really doesn't need any of the bells & whistles of the
<input type="text"/>, since it's invisible.

You can just write <input type="hidden" value="..." /> and that's it, no?

>  
> Also, how to create custom jelly tags that can be used by a set of
> plugins?
>  
> This is the "textboxhidden.jelly" file.
> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
> xmlns:d="jelly:define" xmlns:f="/lib/form">
>   <st:documentation>
>     Generates an input field <tt><input type="text" ... /></tt> to be
>     used inside <f:entry/>
>
>     <st:attribute name="field">
>       Used for databinding. TBD.
>     </st:attribute>
>     <st:attribute name="name">
>       This becomes @name of the <input> tag.
>       If @field is specified, this value is inferred from it.
>     </st:attribute>
>     <st:attribute name="value">
>       The initial value of the field. This becomes the @value of the
> <input> tag.
>       If @field is specified, the current property from the "instance"
> object
>       will be set as the initial value automatically,
>       which is the recommended approach.
>     </st:attribute>
>     <st:attribute name="default">
>       The default value of the text box, in case both @value is and
> 'instance[field]' is null.
>     </st:attribute>
>     <st:attribute name="checkUrl">
>       If specified, the value entered in this input field will be
> checked (via AJAX)
>       against this URL, and errors will be rendered under the text
> field.
>
>       If @field is specified, this will be inferred automatically,
>       which is the recommended approach.
>     </st:attribute>
>   </st:documentation>
>   <f:prepareDatabinding />
>   <input class="setting-input ${attrs.checkUrl!=null?'validated':''}"
>          name ="${attrs.name ?: '_.'+attrs.field}"
>          value="${attrs.value ?: instance[attrs.field] ?:
> attrs.default}"
>          id="${attrs.id}"
>          type="hidden"
>          checkUrl="${attrs.checkUrl}" checkMethod="${attrs.checkMethod}"
>          onchange="${attrs.onchange}" onkeyup="${attrs.onkeyup}"/>
> </j:jelly>
> thanks
> Nambi
>  
>

--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/


smime.p7s (4K) Download Attachment
Sankaran, Nambi

RE: Jelly tag for hidden jelly tag

Reply Threaded More More options
Print post
Permalink
Thanks Kohsuke

This is a very useful tag, for passing generated values back and forth
from the plugin.
The hidden tag allows it to be hidden from the user.

 

-----Original Message-----
From: Kohsuke Kawaguchi [mailto:[hidden email]]
Sent: Wednesday, October 28, 2009 1:52 PM
To: [hidden email]
Subject: Re: Jelly tag for hidden jelly tag

Sankaran, Nambi wrote:
> Hi Kohsuke
>  
> The standard jelly tags in hudson only have textbox and password.
> One of our plugins require a html input of type "hidden".
> So, we created a "textboxhidden.jelly" and stored it under
> src/main/resources/lib/form in the plugin project.
> It works fine, when we run "hpi:run".
> But it doesn't work when we use the plugin with the hudson war file.
> Why is that?

I believe this is fixed now, but I don't think this tag makes sense, as
a hidden textbox really doesn't need any of the bells & whistles of the
<input type="text"/>, since it's invisible.

You can just write <input type="hidden" value="..." /> and that's it,
no?

>  
> Also, how to create custom jelly tags that can be used by a set of
> plugins?
>  
> This is the "textboxhidden.jelly" file.
> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
> xmlns:d="jelly:define" xmlns:f="/lib/form">
>   <st:documentation>
>     Generates an input field <tt><input type="text" ... /></tt> to
be

>     used inside <f:entry/>
>
>     <st:attribute name="field">
>       Used for databinding. TBD.
>     </st:attribute>
>     <st:attribute name="name">
>       This becomes @name of the <input> tag.
>       If @field is specified, this value is inferred from it.
>     </st:attribute>
>     <st:attribute name="value">
>       The initial value of the field. This becomes the @value of the
> <input> tag.
>       If @field is specified, the current property from the "instance"
> object
>       will be set as the initial value automatically,
>       which is the recommended approach.
>     </st:attribute>
>     <st:attribute name="default">
>       The default value of the text box, in case both @value is and
> 'instance[field]' is null.
>     </st:attribute>
>     <st:attribute name="checkUrl">
>       If specified, the value entered in this input field will be
> checked (via AJAX)
>       against this URL, and errors will be rendered under the text
> field.
>
>       If @field is specified, this will be inferred automatically,
>       which is the recommended approach.
>     </st:attribute>
>   </st:documentation>
>   <f:prepareDatabinding />
>   <input class="setting-input ${attrs.checkUrl!=null?'validated':''}"
>          name ="${attrs.name ?: '_.'+attrs.field}"
>          value="${attrs.value ?: instance[attrs.field] ?:
> attrs.default}"
>          id="${attrs.id}"
>          type="hidden"
>          checkUrl="${attrs.checkUrl}"
checkMethod="${attrs.checkMethod}"
>          onchange="${attrs.onchange}" onkeyup="${attrs.onkeyup}"/>
> </j:jelly> thanks Nambi
>  
>


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]