Thanks Igor!

It worked like a charm.

New class:

public class HiddenTextField extends TextField {
        public HiddenTextField(final String id) {
                super(id);
        }

        public HiddenTextField(final String id, IModel model) {
                super(id, model);
        }

        protected final void onComponentTag(final ComponentTag tag) {
                checkComponentTag(tag, "input");
                checkComponentTagAttribute(tag, "type", "hidden");
                super.onComponentTag(tag);
        }
}

---
Form:
treeStateModel = new Model(new String());
add(new HiddenTextField("treeState", treeStateModel));

onSubmit:
String treeState = (String) treeStateModel.getObject(null);

...
function getTreeValues() {
    var treeState = document.getElementById("treeState");
    treeState.value = tree.getAllChecked();
    document.frm.submit();
}

// -->
</SCRIPT>

<form name="frm" wicket:id="detailForm" onSubmit="getTreeValues();">
    <input wicket:id="treeState" id="treeState" type="hidden" value=""/>
...

Jan

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Igor
Vaynberg
Sent: 20. juli 2005 02:41
To: wicket-user@lists.sourceforge.net
Subject: RE: [Wicket-user] javascript tree-component

Mod textfield to work with <input type="hidden" instead of <input
type="text" and have your javascript update that value any time there is
a
change. Quick and dirty ;)

Igor


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jan
Mikkelsen
Sent: Tuesday, July 19, 2005 6:31 PM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] javascript tree-component

Well, I have started using dhtmlxTree. I do need a solution this week.
What
I can't figure out is how to transfer tree state (checkboxes)  from
javascript to Wicket. I can get the state as a single string by calling
a
javascript function, but how do I transfer it to Wicket? A quick and
dirty
solution is fine :)

Jan



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from
IBM. Find simple to follow Roadmaps, straightforward articles,
informative
Webcasts and more! Get everything you need to get up to speed, fast.
http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user






-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to