This topic is locked

Ignore an event...

12/5/2012 2:02:34 PM
PHPRunner General questions
C
CarLN author

Hi!
Using PHPRunner 6.2
Please, I have a problem. I have a table named "item" and another table named "ipv4". In "ipv4" I have a field "id_item" which link in field "ID" from "item". In this table, ipv4, I have various fixed records. I need only alter the field id_item when I add IPs on Item.
In event "Before record added" from table "ipv4" I put:
global $conn;
$strSQL = "UPDATE ipv4 SET id_item = " . $_SESSION["id_item"] . " WHERE ID =" . $values["ID"];

db_exec($strSQL,$conn);
But I DO NOT WANT that records to be added! I tried with "return false", "exit()", etc... and nothing. I can't stop adding and continue to process.
Sorry for my bad english, it isn't my native language... :x
Thanks!

Sergey Kornilov admin 12/5/2012

return false; will do the job.

C
CarLN author 12/5/2012



return false; will do the job.



No, because it gives an empty message and does not continue (the windows pop-up does not close) <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=68860&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

C
cgphp 12/5/2012

Use the "Before record edit" event instead.

C
CarLN author 12/6/2012



Use the "Before record edit" event instead.



Hi!

But the process occurs when I add IPs to Item. I can't let add a new record. I need only alter "id_item", and the IP stay associated to Item.
I will show some screenshots...
When I add an Item and go to section IPV4:


When I add a fixed record and associate him:


And, finally, when I click in Salvar (Save in English):


Did you understand? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=68867&image=4&table=forumreplies' class='bbc_emoticon' alt=':D' />
I need only alter, not to add. But when I make the interface which implies multiples IPs to an Item, I need use "Add". So I want to avoid "Add" and it only alter.
Please see my table structure... equipamento = item.


Thanks and sorry for my bad english :x

Sergey Kornilov admin 12/6/2012

Unfortunately there is no way in inline mode to prevent record from being added and not to display an error message. We'll see if we can add a workaround in the next version.

C
CarLN author 12/6/2012



Unfortunately there is no way in inline mode to prevent record from being added and not to display an error message. We'll see if we can add a workaround in the next version.



Hmmm... So I will make it different... thanks a lot and would be interesting add this workaround for all events <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=68874&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />