Random code

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
Moh Youba
Veteran Member
Posts: 67
Joined: 2017-03-12 09:31

Random code

Post by Moh Youba » 2019-08-26 01:56

Hello
I am trying this code to generate random code, but I have a problem. When I open existing record and make change the random code change.
Please how can I edit the code to change only new records, not existing record.

Here the code I am using

function transferts_argent_dv($selectedID, $memberInfo, &$html, &$args){
if(!$SelectedID){
ob_start();
?>
<script>
$j(function(){
$j('#code_transaction').val( parseInt(Math.random() * 100000000) );
})
</script>
<?php
$html .= ob_get_contents();
ob_end_clean();
}
}


Thank you

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 553
Joined: 2018-04-01 10:12

Re: Random code

Post by pböttcher » 2019-08-28 13:27

Hi,

I think you need to change the check from

if(!$SelectedID){ --> if(!$selectedID){

then it should work.

Moh Youba
Veteran Member
Posts: 67
Joined: 2017-03-12 09:31

Re: Random code

Post by Moh Youba » 2019-08-28 14:00

Hi
thank you for your help, I am goind to give a try.

Best regards,

Moh Youba
Veteran Member
Posts: 67
Joined: 2017-03-12 09:31

Re: Random code

Post by Moh Youba » 2019-08-28 14:07

Great thanks, working as expected.
Thanks again for your support

Post Reply