struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Loschen" <>
Subject RE: Struts action call in a JS method returns blank page
Date Thu, 22 Feb 2007 21:22:10 GMT
I promised that I'd report back with the eventual solution, so here

There were quite a few problems that I ended up finding along the way,
but the most important one was that I was trying to feed form element
values as arguments to a JS function, and the form hadn't been submitted
yet at that point, so I was always getting null. Instead, I parsed the
query from the URL and got the values I needed from there and that did
what I needed.

I can provide some more details off-line if anyone wants them, but since
this was sort of an off-topic thread to begin with, I don't want to
waste everyone's time. 

Thanks again for everyone's help on this!


-----Original Message-----
From: Christopher Loschen [] 
Sent: Monday, February 12, 2007 9:46 PM
To: Struts Users Mailing List
Subject: RE: Struts action call in a JS method returns blank page

Thanks again for your help. I checked the innerHTML code and it does
refer to innerHTML, not innerHtml as I mistakenly remembered. My code
all does appear to be inside functions.

What I've done at this point is reverted to the code that existed
before, and the JS is now working (I think -- more testing needed). The
difference there is that the code was manipulating strings and appending
them directly onto the URL and I was trying to do the same thing with
form elements. I still think my approach would be cleaner, but it isn't
working so I'm willing to admit defeat.

The next problem is actually getting these URL attributes into my Struts
action form, so I think I'm returning to a more or less on-topic
question! The script did just change the location without submitting the
form, so that wasn't working. I added a branch for the situation when I
did need to submit the form for Struts which takes the same data that
was being added to the URL and sets it up as form fields instead. That
is working for two of the three sets, but not the third. For that one, I
keep getting "[object]" or "[undefined]" or something like that instead
of the (possibly empty) string I expect. I tried setting up a hidden
field in the form to hold the property I needed, but that didn't help.
One thing I haven't tried yet is to initialize the value of the property
in that hidden field, something along the lines of 

<html:hidden property="checkboxes_across" value=""/>

I have the property now, but not the value attribute. Worth a try, I
guess. I feel like I'm almost there, but it's taking much longer than I
had hoped. Oh well.

Thanks again for your help, everyone. If you have any more suggestions,
I'm happy to hear them. I'll report back when I finally do figure it all


-----Original Message-----
From: Christopher Loschen [
<> ]
Sent: Sunday, February 11, 2007 5:25 PM
To: Struts Users Mailing List
Subject: RE: Struts action call in a JS method returns blank page

Yeah, that's why I was suspicious. I'm not sure what the code is doing,
but it was there before I got there. On the other hand, before I started
mucking with the code, it was working enough that it usually kept the
correct boxes checked when I changed pages -- it just didn't get the
checked boxes that weren't on the current page saved to the Struts form.
My best bet might be to revert to the JS that was working and try to
figure out the other problems instead.



From: Frank W. Zammetti [
<> ]
Sent: Sun 2/11/2007 10:14 AM
To: Struts Users Mailing List
Subject: Re: Struts action call in a JS method returns blank page

Christopher Loschen wrote:
> I'm suspicious of some code elsewhere on the page that reloads the
entire page -- I don't have it in front of me right now, but it goes
something like:

Woah, are you saying the form your trying to work with was dynamically
inserted into the page via innerHTML?  If so, the problem you may be
encountering is that content inserted with innerHTML isn't necessarily
added to the DOM at all.  I've frankly never spent the time to determine
the pattern, but I know there are some instances, in one browser or
another, where the DOM isn't updated, and other times it is.  I
typically just avoid using innerHTML to insert anything I know I'm going
to want to access later :


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message