Announcement

Collapse
No announcement yet.

Inline button in Multiple Record Form

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

  • Inline button in Multiple Record Form

    Dear Forum Members,

    Is there any way to place buttons inline(I tried with label fields and input type button) in multiple record form which can do php method or JavaScript method?

    In multiple record form how do I setfocus to a specific field by javar?

    Regads
    Rajibul
    __________________
    S. M. Rajibul Huda
    CEO & Founder
    www.efficienterp.com

  • #2
    Hi,
    to answer your first question, create a label field and onLoadRecord:
    {label_field} = "<button type='button' onclick=alert('Test')>Click here</button>";

    To your second question:
    Let's assume you have a field {custname}. To set the focus to a specific name you also need to know (calculate) the row number where it's shown (ie 3).
    Scriptcase has an (undocumented) ajax/javascript function scFocusField() which can be used to set the focus.
    All you have to do is to piece together the field name and row number and call this function by using the sc_ajax_javascript() macro.


    sc_ajax_javascript('scFocusField,array('custname_3 '));

    Hope this helps.

    jsb

    Comment


    • #3
      Hi JSB,

      Thanks for your quick response. First one, my requirement is e.g., i want the button which provided by sc inline not label with input type=button....... or if that, how do I do the php operation with db interaction with that not just showing alert. I know you can help me in this regard as far in this forum you're the genius!
      Second, you've given the example for specific record but how do I determine dynamically in which record I'm in?

      Thanks & Regards
      Rajibul
      __________________
      S. M. Rajibul Huda
      CEO & Founder
      www.efficienterp.com

      Comment


      • #4
        Originally posted by rajibul View Post
        Hi JSB,

        or if that, how do I do the php operation with db interaction with that not just showing alert.
        Alert() is just an example, you can call your own javascript methods instead.

        You can't call php methods, however depending on your needs a solution could be to call a blank application where you can do all your php stuff and redirect back to your form.

        onLoadRecord:

        {label_field} = "<button type='button' onclick=\"location.href='../my_blank_app/my_blank_app.php'\" >Click here</button>";


        To get the row number you're in is a bit tricky since there is no access to those values, so we need to calculate it with the help of an array.

        onApplicationInit:
        [rows] = array();
        [cur_row] = 1;
        // set both variables to Out

        onLoadRecord:
        [rows][] = {cust_id}; //store the id in the array

        onLoad:
        [rows][] = 0; //mark the end of the page shown

        onNavigate:
        [rows] = array_slice([rows],array_search(0,[rows])+1); //reset the array for the new page


        You need an Ajax Event (i.e. onClick) on any field (i.e. {custname})
        [cur_row] = array_search({cust_id},[rows])+1; // that's the row number you're in

        Somewhere in your app:
        $focusfield = {custname}.'_'.[cur_row];
        sc_ajax_javascript('scFocusField',array($focusfiel d));

        There you have it. :-)

        jsb

        Comment


        • #5
          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!
          Last edited by mitja; 02-03-2015, 07:35 PM. Reason: More info about my question.

          Comment

          Working...
          X