Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
Mike Ring
Multiple Address Bug?
April 6, 2009 9:29 AM
Answer

Mike Ring

Rank: New Member

Posts: 16

Join Date: December 18, 2007

Recent Posts

I'm running into a bug with adding a second address. It seems to be a problem with naming the street address fields.

I am using Community 5.2.2, and it shows up both in the source downloads and in the Tomcat bundle.

The following steps should replicate the problem:
1. Log in as any user. It is easiest to see if the user has no addresses registered
2. Go to "My Account"
3. Select "Addresses"
4. Fill in the address fields that are shown by default.
5. Click the "+" symbol to add a new address.
At this point, I get an error in my Tomcat logs--a java.lang.IllegalArgumentException--that comes from a json service problem.
6. Fill in the new address information, click "Save"
7. My first address will save correctly.
My second address will save the city, zip code, type, and the mailing checkbox. It will then throw an error and ask me to enter a valid street. Now if I re-enter the address, it will save correctly.

You can also move step 6 (clicking "Save") to before you add a new address (step 5) and it gives the same errors.

The problem that I see is that in the first address, the Street Address 1 field has a value of "addressStreet10." In the second address, all of the Street Address values have input values of "addressStreet2," while the code is looking for something that would be like "addressStreet12."

It seems that the JavaScript call to create a new address isn't working quite right. Any help would be great.
Amos Fong
RE: Multiple Address Bug?
April 6, 2009 12:40 PM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1844

Join Date: October 7, 2008

Recent Posts

Hey Mike,

It looks like the javascript to add a new row is interpreting the 1,2,3 after address as part of the index.

from auto_field.js
1
2var oldName = el.attr('name');
3var originalName = oldName.replace(/([0-9]+)$/, '');
4var newName = originalName + newSeed;
Mike Ring
RE: Multiple Address Bug?
April 6, 2009 1:29 PM
Answer

Mike Ring

Rank: New Member

Posts: 16

Join Date: December 18, 2007

Recent Posts

Amos,
That looks like it. I'm not sure how to fix it short of making two separate replace methods, one for address fields (or fields where the base name has a number following it), and one for all other fields. In theory, you could get up to having double-digit numbers of addresses (and I don't know what all this addRow method is used for), so you wouldn't be able to differentiate fields with just one regex.

Thoughts on how to fix it, and should I put this in JIRA?
Amos Fong
RE: Multiple Address Bug?
April 6, 2009 2:30 PM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1844

Join Date: October 7, 2008

Recent Posts

I'm not sure how to fix it short of making two separate replace methods, one for address fields (or fields where the base name has a number following it), and one for all other fields. In theory, you could get up to having double-digit numbers of addresses (and I don't know what all this addRow method is used for), so you wouldn't be able to differentiate fields with just one regex.


I can't think of a good way either because you can hit add from any address. The only thing I can think of for now is changing the names to StreetA, StreetB, etc. But you would have to change the java classes too, and this could be potentially breaking elsewhere. If you come up with anything better, please share. =)

Thoughts on how to fix it, and should I put this in JIRA?

Definitely =) thanks
Mike Ring
RE: Multiple Address Bug?
April 7, 2009 12:07 PM
Answer

Mike Ring

Rank: New Member

Posts: 16

Join Date: December 18, 2007

Recent Posts

Posted to JIRA here:

http://issues.liferay.com/browse/LPS-2815

We'll just work around it until a fix happens.
Rayn Rayn
RE: Multiple Address Bug?
December 22, 2010 2:22 AM
Answer

Rayn Rayn

Rank: New Member

Posts: 3

Join Date: July 22, 2010

Recent Posts

I am using Liferay 6.0.5(latest) Community Edition

When i login as test@liferay.com ---> control panel ---> MyAccount and then edit details of test i.e. Admin.
I just enter the details then go to address page fill the address details --> phone details----> web url----> email ids.
Save it.

Things gets saved immedately but when try deleting address enter multiple address press '+' and '-' button and enter multiple phone details '+' and '-', and then save the MyAccount page it gets saved.

But still i repeat steps and try playing with Address,Phone details,WebUrl and Email Id and save. then ALL THE DETAILS GETS DELETED AUTOMATICALLY..!

when i check the Data base (Oracle) the results gets deleted..!

Please can u get me patch of this issue..



I have also raise the issue in JIRA
http://issues.liferay.com/browse/LPS-14446
Sergio González
RE: Multiple Address Bug?
January 3, 2011 1:55 AM
Answer

Sergio González

LIFERAY STAFF

Rank: Expert

Posts: 274

Join Date: January 7, 2010

Recent Posts

Hi Rayn,
I think this has been fixed here: LPS-12353. Could you please check if this solution works for you?
Cheers!