Hello guys,

I'm very new to Wicket and I was trying out some examples and Ajax stuff. I
created a small ajax editable label for fun and I had to set the
setOutputMarkupPlaceholderTag() flag to true. As my understanding, when you
set a component to be invisible, it does not render at all in the page, so
the Ajax code can't find the object by it's id to update it. When setting
the markup placeholder, wicket do output the component to the page, but with
a CSS style that makes it invisible to the user. Good. It worked, I was
happy.

I then got the AjaxEditableLabel from wicket-extensions and went to check
the code to see how they implemented it. I was puzzled as I couldn't find
any calls to setOutputMarkupPlaceholderTag() method on the label and text
field. If I check the source code in the browser, the text field is not in
the html. So how can the java code set the field to be visible and the ajax
code runing on the browser find it?

See example:

My output code with setOutputMarkupPlaceholderTag(true)

<form id="ajaxInlineForm9" action="..." method="post" onsubmit="..."
wicket:id="ajaxInlineForm">
    <div style="display: none;">
        <input name="ajaxInlineForm9_hf_0" id="ajaxInlineForm9_hf_0"
type="hidden">
    </div>
    <span id="inlineFormValuea" onclick="..."
wicket:id="inlineFormValue">Click here to update this
message...</span>
    <input id="inlineFormFieldb" style="display: none;">  <!-- **** If
I ommit a call to setOutputMarkupPlaceholderTag() this is not rendered
back to the browser -->
</form>

This is the output using AjaxEditableLabel

<p>

    This is an
        <span id="ajaxEditableLabelc" wicket:id="ajaxEditableLabel">
            <!-- As you can see, there's no markup for the input field -->
            <wicket:panel>
                <span id="labeld" onclick="" wicket:id="label">ajax
editable label</span>
            </wicket:panel>
        </span>
    from wicket-extensions
</p>


Whats interesting is that html in the source code of AjaxEditableLabel do
include the input field:

<wicket:panel><span wicket:id="label">[[label]]</span><input type="text"
wicket:id="editor"/></wicket:panel>

Any hints as to why they don't need to call setOutputMarkupPlaceholderTag(true)
would be appreciated.

Reply via email to