This topic is locked
[SOLVED]

 onload two code but second code working

1/17/2019 1:12:13 PM
PHPRunner General questions
M
mersintarim author

hi,

I have two button(I created with code snippet)

  1. button code snippet is (echo '<BUTTON id="print_selected2" name="print_selected2" title="Görev Kağıdı yazdır" class="btn btn-primary" >

    <SPAN class="glyphicon glyphicon-print ">

    </SPAN>

    </BUTTON>'<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=26141&image=1&table=forumtopics' class='bbc_emoticon' alt=';)' />
    2.button code snippet is (echo '<BUTTON id="print_takipformu" name="print_takipformu" title="Araç İş Güvenliği Takip Formu yazdır" class="btn btn-primary" >

    <SPAN class="glyphicon glyphicon-wrench ">

    </SPAN>

    </BUTTON>'<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=26141&image=2&table=forumtopics' class='bbc_emoticon' alt=';)' />
    this code list page jscript onload

    1.button clicked must be A area code and 2.button clicked must be B area code

    but only B area code working, A area code not working.
    A area

    ----------

    var submitUrl="gorev_kagidi_print.php";

    if(typeof id=="undefined"){id=this.id;}
    pageObj=this; m

    $("#print_selected2").unbind("click").bind("click",function(e){

    var selBoxes = pageObj.getSelBoxes(pageid);

    var form=new Runner.form.BasicForm({

    standardSubmit:true,

    submitUrl:submitUrl,

    method:'POST',

    target:'_blank',

    id:pageObj.id,

    baseParams:{"a":'print'},

    addElems: pageObj.cloneFormElements(selBoxes)

    });
    form.submit();

    form.destructor();

    });
    B area code

    ----------------
    var submitUrl="takip_formu_print.php";

    if(typeof id=="undefined"){id=this.id;}
    pageObj=this;

    $("#print_takipformu").unbind("click").bind("click",function(e){

    var selBoxes = pageObj.getSelBoxes(pageid);

    var form=new Runner.form.BasicForm({

    standardSubmit:true,

    submitUrl:submitUrl,

    method:'POST',

    target:'_blank',

    id:pageObj.id,

    baseParams:{"a":'print'},

    addElems: pageObj.cloneFormElements(selBoxes)

    });
    form.submit();

    form.destructor();

    });
    where is my fault?
    Best regards.

admin 1/18/2019

I don't think anyone can tell you what is wrong simply looking at this code. I won't suggest creating buttons via code snippet, use regular 'Insert button' functionality in Page Designer.
Also you need to see if there are any Javascript errors in your code:

https://xlinesoft.com/phprunner/docs/troubleshooting_javascript_errors.htm

https://xlinesoft.com/phprunner/docs/troubleshooting_custom_buttons.htm

M
mersintarim author 1/18/2019

hi,

solved,
second code

submitUrl:submitUrl to submiturl2

now working

best regards