Here's a mixin, implement activation context and one GET request with the
search terms in the context will be done:

    <t:textfield value="dummy" t:mixins="livelinkcontext" t:linkId="linkid"
t:placeholder="placeholdergibberish3452" />
    <t:pagelink id="linkid" page="index"
context="literal:placeholdergibberish3452">Search</t:pagelink>



/**
 * Replace the context of a link with a value from a textfield
 */
@IncludeJavaScriptLibrary({"context:/js/mixins.js"})
public class LiveLinkContext
{
  @InjectContainer
  private ClientElement element;
  @Inject
  private RenderSupport renderSupport;
  @Parameter(defaultPrefix="literal")
  private String linkId;
  @Parameter(defaultPrefix="literal")
  private String placeholder;
  
  void afterRender()
  {
    renderSupport.addScript(String.format("new
LiveLinkContext('%s','%s','%s');", element.getClientId(), linkId,
placeholder));
  }
}


var LiveLinkContext = Class.create({
        initialize : function(textfieldId,linkId,placeholder) {
                try {
                        this.textfield = $(textfieldId);
                        this.link = $(linkId);
                        this.oldhref = this.link.href;
                        this.regex = new RegExp(placeholder, "g");
                        Event.observe(this.textfield, 'keyup',
this.updateContext.bindAsEventListener(this));
                        this.updateContext();
                } catch (ex) {
                        //log(ex);
                }
        },
        updateContext : function() {
                this.link.href = this.oldhref.replace(this.regex, 
this.textfield.value);
        }
});
-- 
View this message in context: 
http://tapestry-users.832.n2.nabble.com/Is-there-any-way-to-render-the-get-method-of-form-tp5449243p5603046.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to