Announcement

Collapse
No announcement yet.

Create Custom Button Next To Form Field

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

  • #16
    Hello JaunLukePicard,

    I had a glance into the code of Thickbox.
    As far as I can see there is no URL parameter implemented for the position.
    It seems to be hard coded to position into the mid of 'window'.

    However:
    Thickbox is open source and you can find the code at: http://codylindley.com/thickbox/
    Thus you could add this function.

    Regards
    Gunter Eibl
    email@GunterEibl.de

    asdw.de - Scriptcase & Open Source projects (German/English)
    scriptcase.coach - professional coaching for Scriptcase users (German)
    GunterEibl.de - About me (German)

    Comment


    • #17
      Thank you Gunter/ I will check that out.

      Comment


      • #18
        Originally posted by GunterEibl View Post
        Hi handsprince,

        let me try to explain one way to do it:

        1. Create a form with one element: A Date/Time field named 'date_of_last_Button_click'
        That's where the button will insert the current date/time.

        2. Create a button on this form to place the code into. That has to happen, when clicked. We're using a button of AJAX type.
        The code in this button will be:
        {date_of_last_Button_click} = date("Y-m-d H:i:s");
        Thus a click onto the button will insert the current date/time into that field.

        Example:

        [ATTACH=CONFIG]n70485[/ATTACH]



        3. Run the form and get the code of that button, which now is within the toolbar of the form.
        Now get the HTML code to execute when you click onto that button:
        I'm using Chrome, therefore I right click onto the button to get the window to examine the code.
        There we copy the part of the <a href ... > ... </a> code into the clipboard.


        [ATTACH=CONFIG]n70486[/ATTACH]




        4. Create a new field 'click_me' (type LABEL) and place it onto the form where you want to have the new button. Let's say right of the date/time field.
        (Make sure that the label of 'click_me' field is empty.)


        5. Create a ON LOAD event in the form and tell 'click_me' which HTML-code to show. In fact it is the code which we copied into the clipboard:

        {click_here} = '<a href="javascript: sc_btn_set_date_time()" id="sc_set_date_time_top" onclick="sc_btn_set_date_time(); return false;" class="scButton_default" style="vertical-align: middle; display:inline-block;">set_date_time</a>' ;


        6. Polish: Remove the original button from the toolbar - do NOT delete it, cause the code is still needed for execution.


        7. Now the new form has a button right to the field and if you click onto the button that field will show the current date/time.

        [ATTACH=CONFIG]n70488[/ATTACH]



        I hope this helps to have a button everywhere on a form.

        Gunter Eibl
        Munich, Germany




        this solution is great to create personalized buttons, thank you very much for sharing the knowledge.

        Comment


        • #19
          HI,

          I tried following the steps to create a new button after upgrade scriptcase version but i was unable to find the "a href" code anymore. Now the code showing like below.

          New button - {Depart} = '<a id="sc_Depart1_top" onclick="scBtnFn_Depart1(); return false;" class="scButton_default" style="vertical-align: middle; display:inline-block;">Depart1</a>';

          Old button - {ClickIn} = '<a href="javascript: sc_btn_sc_btn_0()" id="sc_sc_btn_0_top" onclick="sc_btn_sc_btn_0(); return false;" class="fileinput-button fileinput-button-padding scButton_default" style="vertical-align: middle; display:inline-block;">Job Start</a>';

          The biggest difference for these buttons is for old button i able to execute my ajax code when i hide the actual button from toolbars, but for the new button, it won't execute my ajax code when i hide the new button from the toolbar. Anyone can give me hints on how to solve this?

          Comment


          • #20
            HI,

            I tried following the steps to create a new button after upgrade scriptcase version but i was unable to find the "a href" code anymore. Now the code showing like below.

            New button - {Depart} = '&lt;a id="sc_Depart1_top" onclick="scBtnFn_Depart1(); return false;" class="scButton_default" style="vertical-align: middle; display:inline-block;"&gt;Depart1&lt;/a&gt;';

            Old button - {ClickIn} = '&lt;a href="javascript: sc_btn_sc_btn_0()" id="sc_sc_btn_0_top" onclick="sc_btn_sc_btn_0(); return false;" class="fileinput-button fileinput-button-padding scButton_default" style="vertical-align: middle; display:inline-block;"&gt;Job Start&lt;/a&gt;';

            The biggest difference for these buttons is for old button i able to execute my ajax code when i hide the actual button from toolbars, but for the new button, it won't execute my ajax code when i hide the new button from the toolbar. Anyone can give me hints on how to solve this?

            Comment


            • #21
              Hi handsprice,

              you're right. Scriptcase did change the way they handle this.
              We bumped into this during a coaching at a customer over here some weeks ago.

              In fakt, Scriptcase now calls a JS function, where they check if the button is visible.

              You can bypass this by changing the fuction which is called in the onclick event.

              Sample:
              replace onclick="scBtnFn_button_link() with onclick="sc_btn_button_link()

              Or in your case you should change scBtnFn_Depart1() to something like sc_btn_Depart1()

              I hope this will help you.

              Sincerely

              Gunter Eibl

              Gunter Eibl
              email@GunterEibl.de

              asdw.de - Scriptcase & Open Source projects (German/English)
              scriptcase.coach - professional coaching for Scriptcase users (German)
              GunterEibl.de - About me (German)

              Comment

              Working...
              X