J
|
Jane 2/9/2009 |
Hi, if ($values["FieldName"]) { //check this value here //and show error message if needed $message = "values are already stored"; return false; } return true; |
F
|
fryon author 2/9/2009 |
Hi, check entered value in the Before record added/Before record updated events on the Events tab. Here is a sample:
|
F
|
fryon author 2/10/2009 |
Anybody out there? can you give a slight idea for this? |
T
|
thesofa 2/11/2009 |
get the entered value into a string |
F
|
fryon author 2/11/2009 |
get the entered value into a string explode the string set each part of the string into a variable, so now you have three variables, $variable1, $variable2 and $variable3 do a select query where the filter option is 'contains $variable1 AND $variable2 AND $variable3. If the result of the query contains a record, reject entry.
|
T
|
thesofa 2/13/2009 |
send me the table structure and I will play with it to try to give you a working example, this could be useful for many applications. |
J
|
Jane 2/13/2009 |
Hi, |
T
|
thesofa 2/13/2009 |
Hi <?php
|
A
|
alang 2/15/2009 |
Suspect the following may give better result for the regular expression: |
T
|
thesofa 2/15/2009 |
that is what I suggested in my first answer, but Jane suggested the preg_match function, so I explored that route. |
A
|
alang 2/16/2009 |
that is what I suggested in my first answer, but Jane suggested the preg_match function, so I explored that route. Surely I could use Contains instead of like?
|
T
|
thesofa 2/17/2009 |
OK, lets have another look at this one function BeforeAdd(&$values,&$message,$inline)
|
|
jpedwardspost 3/9/2009 |
Hi Fryon, |
F
|
fryon author 5/18/2009 |
Hi Fryon, Curious problem you posted, don't know whether you ever solved it but you could try this approach: Add a column to your table - maybe call it 'SortedCompound' Index this field so that it can accept unique values only. Use a pre-update event to sort the elements of the compound field that if the user enters e.g. If user enters 731 it sorts to 137, If user enters 173 it sorts to 137, If user enters 713 it sorts to 137 - in each case any combination of 1 and 3 and 7 will sort to 137. Store the sorted value (137) in a variable and execute sql to test whether it already exists in the column 'SortedCompound' If it already exists then throw it out (tell the user) , if it doesn't exist store the both the user value and it's corresponding sorted value. JP
|
E
|
e61 5/18/2009 |
Maybe this regex will do it?: if (preg_match('/[4,5,6]/', $value)) {
|