Have you done any web development before using Wicket?
If so, you should be able to solve this problem by asking yourself the
following questions:
What happens if you click a link on a web page?
Do you think the browser sends the data in a text field on the page to
the server if you click a link?
What about if you put the <input> tag in a <form> and click a link?
What about if you put the <input> tag in a <form> and click a submit button?
In short, I'd suggest thinking a little more about the fundamentals
before playing around with user input in listviews. Have a look at the
examples.
Alastair
P.S. There are ways to do what you're trying to do without needing to
put things in a form, etc., but they involve AJAX and therefore
probably aren't the best solution for whatever it is you're trying to
do.
2008/8/7 Alvin_my <[EMAIL PROTECTED]>:
>
>
> I have add testsListView.setReuseItems(true), but still doesn't work.
> :confused: Hope anyone able to give me hints and guide me to the correct
> implementation... thanks
>
> Refer to "HERE" below:
>
>
> ListView testsListView = new ListView("tests", tests) {
> public void populateItem(final ListItem listItem) {
> final Test myTest = (Test) listItem.getModelObject();
>
>
> final Link editLink1;
> listItem.add(editLink1 = new Link("editLink") {
> public void onClick() {
> Long test_id = myTest.getTest_id();
> TestCanvas testCanvasPage = new TestCanvas(test_id);
> setResponsePage(testCanvasPage);
> }
> });
>
>
> editLink1.add(new Label("title", myTest.getTitle()));
> String test_dateNow = df.format(myTest.getTest_date());
> listItem.add(new Label("date", test_dateNow));
> listItem.add(new Label("time", myTest.getTest_time()));
> listItem.add(new Label("duration",
> myTest.getTest_duration()));
> listItem.add(new Label("status", myTest.getStatus()));
>
> HERE --> testMeModel = new Model("");
> testMeField = new TextField("testMe",testMeModel);
> listItem.add(testMeField);
>
> Lecturer lecturer =
> getQuestionnaireService().getLecturer(myTest.getLecturer().getLecturer_id());
> String lecturerName = lecturer.getPrintableName();
> listItem.add(new Label("creator",lecturerName));
>
> final Link removeLink = new Link("remove"){
> public void onClick() {
> getQuestionnaireService().removeTest(myTest);
> TestManager testManagerPage = new TestManager();
> setResponsePage(testManagerPage);
> }
> };
> listItem.add(removeLink);
> removeLink.add(
> new JavascriptEventConfirmation(
> "onclick",
> "Delete test of " +
> myTest.getTitle() +
> " on " +
> myTest.getTest_date()+
> ", time " +
> myTest.getTest_time()+
> " ? "
> )
> );
>
>
> final Link testMeLink;
> listItem.add(testMeLink = new Link("testMeLink") {
> public void onClick() {
> HERE --> String test_Me2 = (String) testMeField.getModelObject();
>
> System.out.println("#########################");
> System.out.println("####### test_Me = "+test_Me2);
> System.out.println("#########################");
> info("####### test_Me = "+test_Me2);
> }
> });
> }
> };
> HERE --> testsListView.setReuseItems(true);
> border.add(testsListView);
>
>
>
> Martijn Dashorst wrote:
>>
>> 2 days without using google [1,2]?
>>
>> listview.setreuseitems(true);
>>
>> Martijn
>>
>> [1] http://www.google.com/search?q=wicket+form+component+listview
>> [2]
>> http://cwiki.apache.org/WICKET/listview-and-other-repeaters.html#ListViewandotherrepeaters-Usingformcomponentsinarepeater
>>
>> On Thu, Aug 7, 2008 at 10:09 PM, Alvin_my <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> Hi,
>>> I am very new with wicket and I have a problem with TextField within
>>> ListView , I try to getModelObject from the Textfield but return NULL ?
>>>
>>> I am trying my best to find the solution, unfortunately I am running out
>>> of
>>> time with my final project. Already spent 2 days dealing with this small
>>> problem :,(
>>>
>>> Hope you guys can help. Below is the some part of the codes:
>>>
>>>
>>> textfieldModel = new Model("");
>>> textField = new TextField("textfield",textfieldModel );
>>> listItem.add(textField);
>>>
>>> listItem.add(saveLink = new Link("saveLink") {
>>> public void onClick() {
>>> String myText = (String)
>>> textField.getModelObject();
>>> info("####### myText = "+myText );
>>> }
>>> });
>>>
>>> Thanks!!
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Help%21%21-TextField-in-ListView-%3D-NULL-tp18878710p18878710.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.4 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
> Quoted from:
> http://www.nabble.com/Help%21%21-TextField-in-ListView-%3D-NULL-tp18878710p18878862.html
>
> Reply
>
> Forward
>
>
>
>
>
>
>
>
>
>
>
>
> Alvin_my wrote:
>>
>>
>> Hi,
>> I am very new with wicket and I have a problem with TextField within
>> ListView , I try to getModelObject from the Textfield but return NULL ?
>>
>> I am trying my best to find the solution, unfortunately I am running out
>> of time with my final project. Already spent 2 days dealing with this
>> small problem :,(
>>
>> Hope you guys can help. Below is the some part of the codes:
>>
>>
>> textfieldModel = new Model("");
>> textField = new TextField("textfield",textfieldModel );
>> listItem.add(textField);
>>
>> listItem.add(saveLink = new Link("saveLink") {
>> public void onClick() {
>> String myText = (String)
>> textField.getModelObject();
>> info("####### myText = "+myText );
>> }
>> });
>>
>> Thanks!!
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Help%21%21-TextField-in-ListView-%3D-NULL-tp18878710p18881302.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]