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: 228
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

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Random code

Post by pbottcher » 2019-08-28 13:27

Hi,

I think you need to change the check from

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

then it should work.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Moh Youba
Veteran Member
Posts: 228
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: 228
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