Page 1 of 1

Random code

Posted: 2019-08-26 01:56
by Moh Youba
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

Re: Random code

Posted: 2019-08-28 13:27
by pbottcher
Hi,

I think you need to change the check from

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

then it should work.

Re: Random code

Posted: 2019-08-28 14:00
by Moh Youba
Hi
thank you for your help, I am goind to give a try.

Best regards,

Re: Random code

Posted: 2019-08-28 14:07
by Moh Youba
Great thanks, working as expected.
Thanks again for your support