John Zwick

Ranch Hand
+ Follow
since Mar 02, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Zwick

The following works in firefox but is not working in IE where I am getting the error:
"Error: 'options' is null or not an object
Code: 0"



How can I get this to work in IE?

Himanshu Kansal wrote:Hello,

According to what you are trying to do, things are happening correctly. You asked it to output the array object and that is what it gave u.

Concept of arrays for forms is that when you have a control like a series of checkboxes, you can use an array in your form to hold multiple selected values. The values in case of textboxes would normally be overwritten, instead of being mapped to arrays. I am not very sure but I think this is what happens to textboxes.

Still, if I assume that in case you have multiple textboxes, all with the same name attribute, and they do get mapped to the array in your form, then when you have a single textbox, you still would require to refer to its value through the array index, stockID[0] that is.



why cant a single text box map to an array of size 1?
If I refer to its value through the array index, when i add a new row of inputs (which clones the first row of inputs), we will have two input boxes which refer to the same array index.

For example:
Before adding a new row we will have:
"<input type="text" name="stockID[0]" maxlength="10" size="10" "

but after adding another row of inputs, we will get:
"<input type="text" name="stockID[0]" maxlength="10" size="10"
"<input type="text" name="stockID[0]" maxlength="10" size="10"

and when the form gets saved, only one of the inputs is stored and not both.
14 years ago

Ankit Garg wrote:There is only one stockId text field in your JSP page. Then why are you using an array in the Action Form?? If you really want an array, then you should probably iterate over that array in your JSP and display multiple stockId text fields...



I have one row intially but the user can dynamically add rows of inputs via Javascript so theres a possibility of 1 to many text fields
14 years ago
I have a table where each row contains multiple input and select boxes. I have a link where the user can add a new row.
However, I am having trouble resetting those values of those input boxes... I can add a new row just fine but the values are not getting reset

Here is my javascript:


Here is my HTML:


What am i missing here?
In my page, if the user submits a form and there are errors it will go back to the form input page with error messages..

However, when we go back to the page, the text input boxes are not showing what the user inputted... instead, something like "[Ljava.lang.String;@10321032" is shown

My the form bean that corresponds to that text input box is a string array
This is my form bean:



Where am i going wrong here?
14 years ago
Hi everyone, I am having trouble getting my javascript function to delete a specific row from a table. Any ideas what I am doing wrong?

here is my javascript function:


Here is my table where there is a 'Remove' link on each row that passes the row number to the javascript function.

I have a war file that contains several classes. After deploying the war file (no errors while deploying), one of the classes in the war is missing in the installedApps directory on the server. Has anyone experienced this or know how to resolve this?
14 years ago
Thanks guys!
I ended up using:

14 years ago
I have a page where a user can create an account using a form. Inside the form there is a table where they can add form elements (both text boxes and drop downs) dynamically using javascript to add as many new rows of inputs as the user wants.
I understand that when the input properties are stored as an array in the form bean, struts will automatically handle the inputs and set then into the appropriate arrays. However, when the user wants to "edit" their account, I have to display those rows of inputs they entered when they created the account. How does struts handle the order , will they be in the same order as the user entered? How do I tell the jsp to generate the x amount of input rows and populate each row correctly with what the user intially entered?
14 years ago
How can I convert an ArrasyList of type String to a STring array?

Thanks for your help!
14 years ago
I currently have a table of form inputs where the user can add/remove rows via javascript. How can I configure struts to handle these values?
14 years ago
I have 25 input boxes of which are grouped into 5 "messages", each containing 5 lines.
Any suggestions or tips on efficiently validating these text boxes? For example, Messages #2-5 cannot have any values unless Message #1 has values. Also, for a given message, a line can only have values if all the lines before it have values (for example, a message cannot contain values in line 1 and line 5 but not 2,3, or 4).

Is there a more efficient way of doing this without using a ton of if's? In my backend code, each line is assigned to a String object (e.g message2Line3)


14 years ago
Thanks for the fast replies everyone
I'm going to stop testing using IE once and for all!
I am receiving the following error in the Error Console of Firefox however it works perfectly fine in IE 6:
"dropDownElement is null"



Bear Bibeault wrote:Please do not show server-side markup in an HTML forum. Expand the markup to its generated HTML.



oops, my bad

Here is the generated HTML: