Gossamer Forum
Home : Products : DBMan : Customization :

Duplicate adds

Quote Reply
Duplicate adds
Hi Guys,

Has anyone experienced duplicate record additions? I seem to be getting random duplicate entries when adding. The counter field increments and the same data is added to the next ID number. It seems related to IE5, although I can't say for sure.

Thanks in advance
Greg

Quote Reply
Re: Duplicate adds In reply to
It could be that users are clicking the "submit" button more than once. That's the only way I can think of that this would happen.


------------------
JPD





Quote Reply
Re: Duplicate adds In reply to
Hi Carol,

Thanks I will try and simulate the problem and get back to you.

I do have two quetions though if I may impose.
1.
I cannot seem to get the price range search working. What should the form setup be like to search between say 250 000 and 500 000. At present price is definded as numer field and there are no spaces. I can get all prices up a certain range but not between using the < character.

2.
I would like users to enter spaces and the currency value if they choose. Before posting the data I want to strip them out again. I remember a posting a while ago where you had a mod to do this. Please can you let me have it.

Much obliged again.
Tks
Greg
Quote Reply
Re: Duplicate adds In reply to
I'm not sure what you mean about the number range search. Can you give me the range you are entering and the exact results you are getting?

As for stripping out spaces and currency symbols, you would add some code to sub add_record.

To strip out spaces, use
Code:
$in{'fieldname'} =~ s/ //g;

Currency symbols can be tricky. Would it just be dollar signs or would it be other symbols, too? If it's just dollar signs, use
Code:
$in{'fieldname'} =~ s/\$//g;




------------------
JPD





Quote Reply
Re: Duplicate adds In reply to
The code to strip characters from the fields would go in sub add_record, just before

$status = &validate_record;

I really need to make a mod for the range searches. Smile

I'm assuming that your field name is Price. If it's different, you'll need to change every instance of Price below.

Set up your select field as follows:

Code:
<SELECT NAME="Price">
<OPTION value="*">All Prices
<OPTION value="0-250001">Up to 250 000
<OPTION value="249999-500001">250 000 - 500 000
<OPTION value="499999-1000001">500 000 - 1 000 000
<OPTION value="999999">1 000 000+
</SELECT>

In db.cgi, sub query, just after

local (%sortby);

add

Code:
if ($in{'Price'}) {
unless ($in{'Price'} eq "*") {
($in{'Price-gt'},$in{'Price-lt'}) = split (/-/,$in{'Price'});
$in{'Price'} = '';
}
}

This will give you inclusive search ranges.

------------------
JPD





Quote Reply
Re: Duplicate adds In reply to
Hi Carol,

The Currency is a simple R, which I don't beleive will be a problem provided I stript it only from the said filed and not all fields. Where exactly soes this code go in the cgi file?

I need to search from 0-250 000, 250 - 500 000, 500 - 1Million and 1M above.
At present I use select option as follows

<option selected value="*">All Prices</option>
<option value="<110000"> Up to R100 000</option>
<option value="<260000"> Up to R250 000</option>
<option value="<510000"> Up to R500 000</option>
<option value="<1000000"> Up to R1 Million</option>
<option value=">1000000"> Above R1 Million</option

How do I search between 250 and 500 000?

Thanks in advance
Greg
Quote Reply
Re: Duplicate adds In reply to
Hi Carol,

Thanks for the effort and concern. Dbman would be difficult without you. I really appreciate it.

Later
G
Quote Reply
Re: Duplicate adds In reply to
Hi Carol,

Works like charm. Again your services are appreciated. Thanks very much. I added this at the same place for modify as well.

I am concerned though about browser cache problems when adding. In looking into the duplicate additions I seem to get the same ID up when selecting add from an another page. Only when I refresh do I get the count incremented and the correct ID number. Is there a way to overcome this or will the cgi correct this when the add is submitted.

Thanks again
Greg
Quote Reply
Re: Duplicate adds In reply to
The cgi should correct it when the record is added.

I'm not sure what you mean when you say
Quote:
I added this at the same place for modify as well.

The code I gave you should only be in sub query.


------------------
JPD





Quote Reply
Re: Duplicate adds In reply to
Unless I am mistaken the mod works great only for add's though and not for modify. I assumed that the mod can be inserted at the same place for modify. I did this and so far I have not had any problems. I am busy building the database. I will let you know if there are problems. If you can think of a reason why this is not going to work because of the second addition please let me know.

Thanks.
Greg
Quote Reply
Re: Duplicate adds In reply to
I think I misunderstood what you had said before. I was referring to the "range search" mod. That can only be in sub query. The other thing can work fine in sub modify record.



------------------
JPD