Re: [S2] Indexed Lists

2008-12-23 Thread norken76


Hello ,

I am trying to get the textfield list working (in parallel to the check
boxes) but couldn't ??
the function I set to be called is never called after the submit.
I know that the values in the textfiels are sent, and the setter function
for the Checkboxes (setConfigs) is called but not the function for the
textfields (setConfigsList) ??? I assument that this setter should have
String[] for argument as well ?

can you please explain what this function look like in order to be invoked ?

 thank you 


   
   





Roger Varley wrote:
> 
> On Friday 12 September 2008 16:18:02 Jeromy Evans wrote:
> 
>>
>> In the last line, did you confirm that count has the correct value?
>> What if the list is empty? (in that case count has never been set)
>>
> 
> 
> 
> 
> 
> 
> 
> seems to take of things nicely :-) Thanks for your help.
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Indexed-Lists-tp19455272p21148710.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Indexed Lists

2008-09-12 Thread Jeromy Evans

Roger wrote:

Hi

I'm trying to get indexed lists working so that I can get any amendments back 
into my model. At the moment I've got
  


In the last line, did you confirm that count has the correct value?  
What if the list is empty? (in that case count has never been set)




The issue could relate to how valueables is being constructed.  Are you 
creating it, or leaving it to the framework to create it?  It should be 
able to add extra elements to a list


For added entertainment, could anyone point me to a dojo/javascript tutorial 
that would allow me to add a further empty line when ever the user completes
an empty line without, if possible, submitting the form? Or someother 
technique that allows the addition of unknown number form fields?


  


in pure javascript:

var inputEl = document.createElement("input");
inputEl.type ="input";
inputEl.name ="valueables["+count+"]";
var parentEl = document.getElementById("thePositionId");
parentEl.appendChild(inputEl);

and so on. or

parentEl.innerHTML = "";

and so on.

where count is an argument passed to your function (eg in response to a 
click in the next empty row)


You'll find plenty of tutorials along those lines.  The latter approach 
is faster but vulnerable to more browser querks.
Good javascript libraries include function to make the DOM manipulation 
less verbose.








-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] Indexed Lists

2008-09-12 Thread Roger
On Friday 12 September 2008 16:18:02 Jeromy Evans wrote:
> Roger wrote:
> > Hi
> >
> > I'm trying to get indexed lists working so that I can get any amendments
> > back into my model. At the moment I've got
>
> In the last line, did you confirm that count has the correct value?

Yes, I've confirmed that count has the right value. At the moment the list has 
three entries pre-loaded in my action which numbered 0,1 &2 by the iterator
and the count evaluates to 3.

> What if the list is empty? (in that case count has never been set)
>

Good point :-(

Running with an empty list evaluates to valuables[] in the html 

>
> 
>

> The issue could relate to how valueables is being constructed.  Are you
> creating it, or leaving it to the framework to create it?  It should be
> able to add extra elements to a list
>

Doh!!! I had valuables as an inner class of my model class. Moving the code 
into a separate class and lo & behold I can now add to the list when it's 
pre-populated


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] Indexed Lists

2008-09-12 Thread Roger
On Friday 12 September 2008 16:18:02 Jeromy Evans wrote:

>
> In the last line, did you confirm that count has the correct value?
> What if the list is empty? (in that case count has never been set)
>







seems to take of things nicely :-) Thanks for your help.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] Indexed Lists

2008-09-12 Thread Dave Newton
--- On Fri, 9/12/08, Roger wrote:
> 
> 
> 
> 
> 
> 

How about losing the seemingly-unnecessary count?



  
  ...


Dave


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]