Announcement

Collapse
No announcement yet.

Button in grid form to open form

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Button in grid form to open form

    Hi, I created new field in form Editable grid view, clickme.

    Then on onLoadRecord i insert:
    {clickme} = "<button type='button' onclick=\"location.href='../form_bas_indirizzi/form_bas_indirizzi.php'\" >Click here</button>";

    All works fine,the app form_bas_indirizzi is open.

    Now, i want to open form_bas_indirizzi in modal.
    I insert:
    {clickme} = "<button type='button' onclick=".sc_redir(form_bas_indirizzi.php, '', 'modal').">Click here</button>";

    But doesn't work.
    Error:Parse error: syntax error, unexpected 'if' (T_IF) in /opt/NetMake/v8/wwwroot/scriptcase/app/informaCRM/form_view_ind_indirizzi/form_view_ind_indirizzi_apl.php on line 3024

    How can i do it ?
    Thanks
    Marco

  • #2
    you are misusing the sc_redir macro

    for what you are trying you should use the sc_make_link macro to do somehting like this

    PHP Code:
    $link sc_make_link(form_bas_indirizzi);
    {
    clickme} = '<button type="button" onclick="' $link .  '">Click here</button>'
    Hope this helps.

    Kind Regards

    Comment


    • #3
      It does not work. Clicking nothing happens

      Comment


      • #4
        Share your code with me. so i can take a look

        Regards

        Comment


        • #5
          Please make it public - I have the same problem....

          I posted it here: http://www.scriptcase.net/forum/show...le-Record-Form

          My post Copy/Pase:

          How to easily call other grid/form and transfer one variable as reference?

          Like:
          Click here => transfer {this_value_to_form} and open Form_Worker

          I tried many thing, including:

          {Test} = "<button type='button' onclick="sc_redir(Admin_menu, 'parm1 = {idCustomer}', '_parent')">Click here</button>";

          And also:

          function REDIRTEST()
          {
          sc_redir(Admin_menu, "", "_parent");
          }


          {Test} = "<button type='button' onclick='REDIRTEST()'>Click here</button>";


          Thank you for your help!

          Comment


          • #6
            how do I share my code with you? My code is in onLoadRecord:

            {clickme} = "<button type='button' onclick=".sc_redir(form_bas_indirizzi.php, '', 'modal').">Click here</button>";

            The problem is that sc_redir(form_bas_indirizzi.php, '', 'modal') not work. the app is not opened in modal mode.

            I think it's a bug

            Comment


            • #7
              sc_macros are for use in the application events. You can't call php functions from javascript it's just not possible and has nothing to do with SC.

              You might have more luck with this procedure.

              Go to the Link section of the grid and click on New Link. Choose field, select your {clickme} field and follow the instructions.
              At the end selct Modal for the 'Link Operation Mode'.

              Head over to the onRecord event

              {clickme} = "<button type='button'>Click here</button>";


              That's it.

              jsb

              Comment


              • #8
                OK - thank you for this last post.

                Next question around the same problem... Can we call SC Application with php somehow?
                I need to pass one or two variables to called app and it would be nice if I can use button in

                Comment


                • #9
                  Originally posted by mitja View Post
                  Can we call SC Application with php somehow?
                  Yes, but you need to put a little bit more fish by the butter.

                  jsb

                  Comment


                  • #10
                    a little bit more fish by the butter
                    ...i have the same question

                    I want to duplicate a data record into a another table (with a sql command). My first idea - the button start a blank_application with own your php code and then you can load the next application with sc_macros. Its a long way - perhaps there are a lot of another alternatives.

                    Comment


                    • #11
                      Originally posted by jsbinca View Post
                      Yes, but you need to put a little bit more fish by the butter.

                      jsb
                      May I ask for instant solution? How to do it?

                      Comment


                      • #12
                        Originally posted by scripti0815 View Post
                        ...i have the same question

                        I want to duplicate a data record into a another table (with a sql command). My first idea - the button start a blank_application with own your php code and then you can load the next application with sc_macros. Its a long way - perhaps there are a lot of another alternatives.
                        Do you want to copy/paste data from one table to other table? It is not subject for this thread. Please write me pm and I will answer it. It is quite easy task.

                        Or do you want to make button "in line" to do this?

                        Comment


                        • #13
                          Hello mitja,

                          the click on the button should start some own php code (for example a sql command and forwarding another application) . If this is not your question then i have to start a new post. Sorry

                          Thanks!

                          Comment

                          Working...
                          X