{"id":185,"date":"2017-07-21T21:14:31","date_gmt":"2017-07-21T19:14:31","guid":{"rendered":"https:\/\/asdw.de\/?p=185\/"},"modified":"2017-07-21T22:47:24","modified_gmt":"2017-07-21T20:47:24","slug":"place-button-at-any-place-of-scriptcase-form-grid","status":"publish","type":"post","link":"https:\/\/asdw.de\/en\/place-button-at-any-place-of-scriptcase-form-grid\/","title":{"rendered":"Place Button at any place of Scriptcase Form \/ Grid"},"content":{"rendered":"<h2>Show a Scriptcase Button within a Form or Grid<\/h2>\n<p>It&#8217;s easy to create a button on the top or bottom of a Scriptcase form or Grid application (as element of the toolbar).<\/p>\n<p>But sometime you might need buttoms directly near certain elements within the form (or within the line of a grid).<\/p>\n<h3>1. Create a link for the action (if you click on the button)<\/h3>\n<p>One of the easiest ways is to use the Scriptcase macro:<\/p>\n<p><span class=\"lang:php decode:true crayon-inline\">sc_make_link(Application, Parameters)<\/span><\/p>\n<p><strong>example:<\/strong><\/p>\n<p><span class=\"lang:php decode:true crayon-inline\">$string_link = sc_make_link(grid_images, ref_object_type=&#8217;contact&#8217;;ref_object_id={id});<\/span><\/p>\n<p>The generates a string with the link to the Grid-application\u00a0&#8216;grid_images&#8217; and passes the parameters\u00a0&#8216;ref_object_type&#8217; and &#8216;ref_object_id&#8217;<\/p>\n<h3>2. Create a label field<\/h3>\n<p>Create a field of &#8216;Label&#8217; type within the form \/ grid and insert it at the place the button will appear.<\/p>\n<p>Our example uses a Label-field named\u00a0&#8216;edit_picture&#8217;<\/p>\n<p>Then the new field will be filled via PHP-code (i.e. in the event OnLoad):<\/p>\n<p>&nbsp;<\/p>\n<h3>3. Set the Content of the field<\/h3>\n<p>Add a usual HTML link (via a href) as contact of the field:<\/p>\n<p><span class=\"lang:php decode:true crayon-inline\">{edit_pictures} = &#8216;&lt;a href=&#8221;&#8216; . $string_link . &#8216;&#8221; class=&#8221;scButton_small&#8221; title=&#8221;Edit the picture&#8221; style=&#8221;vertical-align: middle; display:inline-block;&#8221;&gt;&#8217; . {lang_contact_edit_pictures} . &#8216;&lt;\/a&gt;&#8217;;<\/span><\/p>\n<p>We&#8217;re using the string generated in 1. as link.<\/p>\n<p>&#8216;class&#8217; defines that a small button is to be used. You could also use\u00a0<span class=\"lang:php decode:true crayon-inline \">class=&#8221;scButton_default&#8221;<\/span>\u00a0for a standard button. Hint: Some templates do not support small buttons.<\/p>\n<p>&#8216;title&#8217; defines which text is be shown as popup if the cursor is over the button (PC-browser only).<\/p>\n<p>{lang_contact_edit_pictures} defines which text is shown on the button. (Our sample: Bilder Bearbeiten)<br \/>\nHint: Use plain text instead of\u00a0{lang_contact_edit_pictures} of your&#8217;re not using the multilingual feature of Scriptcase.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>If the lable field is placed below a picture, ot could be show like:<\/p>\n<p><a href=\"https:\/\/asdw.de\/wp-content\/uploads\/2017\/07\/scriptcase_button_on_form_grid.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-155\" src=\"https:\/\/asdw.de\/wp-content\/uploads\/2017\/07\/scriptcase_button_on_form_grid-300x297.png\" alt=\"Button mir Link direkt bei Bild auf einer Form\" width=\"300\" height=\"297\" srcset=\"https:\/\/asdw.de\/wp-content\/uploads\/2017\/07\/scriptcase_button_on_form_grid-300x297.png 300w, https:\/\/asdw.de\/wp-content\/uploads\/2017\/07\/scriptcase_button_on_form_grid-150x148.png 150w, https:\/\/asdw.de\/wp-content\/uploads\/2017\/07\/scriptcase_button_on_form_grid-100x99.png 100w, https:\/\/asdw.de\/wp-content\/uploads\/2017\/07\/scriptcase_button_on_form_grid-200x198.png 200w, https:\/\/asdw.de\/wp-content\/uploads\/2017\/07\/scriptcase_button_on_form_grid.png 357w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Show a Scriptcase Button within a Form or Grid It&#8217;s easy to create a button on the top or bottom of a Scriptcase form or Grid application (as element of the toolbar). But sometime you might need buttoms directly near<span class=\"ellipsis\">&hellip;<\/span><\/p>\n<div class=\"read-more\"><a href=\"https:\/\/asdw.de\/en\/place-button-at-any-place-of-scriptcase-form-grid\/\">Read more &#8250;<\/a><\/div>\n<p><!-- end of .read-more --><\/p>\n","protected":false},"author":2,"featured_media":182,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[55],"tags":[40,41,42],"_links":{"self":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts\/185"}],"collection":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/comments?post=185"}],"version-history":[{"count":1,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts\/185\/revisions"}],"predecessor-version":[{"id":186,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts\/185\/revisions\/186"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/media\/182"}],"wp:attachment":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/media?parent=185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/categories?post=185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/tags?post=185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}