Whoops -- gave you a bum steer -- sorry about that.
instead of display(false);
should be
setClearBeforeDisplay(false);
display();
But that doesn't solve the problem. You will find that each field in the
repeated, in each row, has a comma separated list of all the values for
that field, across the rows.
I can think of an elegant solution that would have no hard-coded field
references, but haven't the time to test/describe.
Some things to think about:
You will need a mode flag in display processing to indicate whether you are
in initial accept mode or in redisplay mode. This could be an instance
variable that is set one way in onbeforeload, another in your button
redisplay method.
In an earlier email today to somebody else, I included an
extractSimpleValues method that would be helpful here.
in your redisplay button method,
do the following:
set display mode to redisplay
for each page-level field outside the repeated, execute getValue (or
getDisplayFieldValue) and stick result into a CSpValue instance variable.
for each field in the repeated, execute extractSimpleValue on the result of
getValue, stick result into a Vector instance variable.
call vanilla display() (default clearbeforedisplay=true) to redisplay the page.
in page-level this_onBeforeRowDisplayEvent:
if redisplay mode,
for each page-level field, execute setValue (or setDisplayFieldValue)
using the associated CSpValue instance variable as the argument.
in repeated_onBeforeRowDisplayEvent
if redisplay mode,
get row index (event.getRowIndex())
for each field
if rowindex < Vector instance variable .size()
call setValue using vector .elementAt(rowindex) (cast to
CSpValue) as argument.
else (new row)
call setValue using new CSpString("") as argument
The more elegant/efficient approach would be to call
getChildren/getRepeated in onAfterInitEvent and build some vectors or
arrays that would drive runtime processing.
-- Curt Springer, Team ND
At 01:14 PM 7/29/99 -0700, David Stanwick wrote:
>I've corrected my email address. Sorry about that.
>
>Cleaned up code and removed references to set rows. I also added another
>text box outside
>of the repeated to make sure data I keyed stayed on the page.
>
>Results with display(false) = keyed data in repeated and in test text box.
>Page reloaded with
>all fields blank.
>
>Results with load("page",false) = keyed data in repeated and in test box.
>Page reloaded with
>garbage in repeated but data in test text box remained.
>
>Curt Springer <[EMAIL PROTECTED]> wrote:
> >Let's try for a baseline first. Can you simply redisplay the rows
> that >were sent back, before taking on trying to add empty rows:
> >
> >1. This shouldn't make any difference, but best to simplify and eliminate
> >noise:
> > It's not necessary to get a reference to the page in order to execute
> >display().
> >
> > You could replace the last 2 lines of the button web event (before
> >'return') with just:
> > display(false);
> >
> >2. Comment out 'setCurrNumRows' and 'setMaxDisplayRows'
> >
> >BTW, if you are posting this via a newsreader, check your configuration. I
> >got your post through the email list, and the reply-to had a dash (-) in
> >"frito-lay".
> >
> >-- Curt
> >
> >
> >At 11:15 AM 7/29/99 -0700, David Stanwick wrote:
> >
> >>I have a repeated with 4 text boxes and initially defined with 5 rows. I
> >>also have a
> >>"Custom" button that does the following:
> >> public int btAddLines_onWebEvent(CSpWebEvent event)
> >> {
> >> CSpCommonRepeated rList = getCommonRepeated("*Repeated1");
> >>
> >> int newMaxRows = rList.getMaxDisplayRows() + iAddLines;
> >>
> >> String sCurrGrandTotal =
> >> getDisplayFieldValue("tbGrandTotal").toString();
> >>
> >> CSpider.putUserSessionObject("usMaxRows",new
> >> CSpInteger(newMaxRows));
> >> CSpider.putUserSessionObject("usGrandTotal",new
> >> CSpString(sCurrGrandTotal));
> >>
> >>// int command =
> load("pgCreateInventoryTotalNoPrefill",false);
> >> CSpPage reloadPage =
> >> CSpider.getPage("pgCreateInventoryTotalNoPrefill");
> >> int command = reloadPage.display(false);
> >>
> >> return(PROCEED);
> >> }
> >>
> >>I also have the following defined to set the max rows in the pages
> >>onDisplayEvent:
> >> public int this_onBeforeDisplayEvent(CSpDisplayEvent event)
> >> {
> >> int iCurrMaxRows = 5;
> >>
> >> CSpCommonRepeated rList = getCommonRepeated("*Repeated1");
> >>
> >> try
> >> {
> >> iCurrMaxRows =
> >> CSpider.getUserSessionObject("usMaxRows").intValue();
> >> }
> >> catch (NullPointerException ex)
> >> {
> >> }
> >>
> >> rList.setCurrNumOfRows(iCurrMaxRows);
> >> rList.setMaxDisplayRows(iCurrMaxRows);
> >>
> >> return (PROCEED);
> >> }
> >>
> >>The page redisplays with the new row count but the previously entered data
> >>is gone.
> >>I hope this helps.
> >>
> >>
> >>Curt Springer <[EMAIL PROTECTED]> wrote:
> >> >OK, now give us code snippets or otherwise tell us how you are getting
> >> the >extra rows to display. Normally display(false) will preserve the
> user
> >> >input, even with the 'repeated' construct.
> >> >
> >> >-- Curt Springer, Team ND
> >> >
> >> >At 08:49 AM 7/29/99 -0700, David Stanwick wrote:
> >> >
> >> >>I tried the display(false) and that got rid of the garbage. I'm still
> >> >>losing the user input
> >> >>though. One note: I mistakenly posted this to ND3. I'm actually running
> >> >>ND4. My
> >> >>mistake.
> >> >>DS
> >> >>
> >> >>Curt Springer <[EMAIL PROTECTED]> wrote:
> >> >> >You want to call display(false), not load(false).>
> >> >> >I presume you already have some way of knowing how many lines you
> started
> >> >> >with. You will probably need to add some onbeforerowdisplayevent
> >> >> >processing to blank out the new rows.
> >> >> >
> >> >> >-- Curt Springer, Team ND
> >> >> >
> >> >> >
> >> >> >At 07:34 AM 7/29/99 -0700, David Stanwick wrote:
> >> >> >
> >> >> >>I have a repeated on a page that I use for user input. I've defined a
> >> >> >>button that allows
> >> >> >>the user to generate additional blank lines in the repeated for more
> >> input.
> >> >> >>
> >> >> >>Within the button code, I call load("page",false) which I understand
> >> loads
> >> >> >>the page without
> >> >> >>refreshing the values.
> >> >> >>
> >> >> >>When the page is reloaded, all of the repeated fields have garbage in
> >> >> >>them. I want to
> >> >> >>preserve what the user entered before pushing the button. The only
> >> >> >>workaround I've
> >> >> >>come up with is to save the values entered into a vector, store that
> >> as a
> >> >> >>user session
> >> >> >>object, and then reload the repeated when the page is redisplayed
> >> but this
> >> >> >>seems to
> >> >> >>be a lot of work to keep the data.
> >> >> >>
> >> >> >>Any ideas?
> >> >> >>__________________________________________________________________
> ___
> >> ____
> >> >> >>
> >> >> >>For help in using, subscribing, and unsubscribing to the discussion
> >> >> >>forums, please go to:
> >> http://www.netdynamics.com/support/visitdevfor.html
> >> >> >>
> >> >> >>For dire need help, email: [EMAIL PROTECTED]
> >> >> >
> >> >>
> >> >>_____________________________________________________________________
> ____
> >> >>
> >> >>For help in using, subscribing, and unsubscribing to the discussion
> >> >>forums, please go to:
> http://www.netdynamics.com/support/visitdevfor.html
> >> >>
> >> >>For dire need help, email: [EMAIL PROTECTED]
> >> >
> >>
> >>_________________________________________________________________________
> >>
> >>For help in using, subscribing, and unsubscribing to the discussion
> >>forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
> >>
> >>For dire need help, email: [EMAIL PROTECTED]
> >
>
>_________________________________________________________________________
>
>For help in using, subscribing, and unsubscribing to the discussion
>forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
>For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]