Jump to content
awebcreature

Field with dynamic (realtime) percent calculation with values from other fields

Recommended Posts

Hello there

I need a field with realtime percent calculation (without page save)  with values from other fields in admin template. I think about jQuery with onChange methods on corresponding fields but this is not clear for me how to do this in module. Any help with some advice or example will be highly appreciated! 

Thanks in advance! 

 

Share this post


Link to post
Share on other sites
3 hours ago, kixe said:

This fieldtype will generate any runtime markup:
https://github.com/kixe/FieldtypeMarkup

Hi @kixe,

I hadn't seen this before. I just had a quick look around and from what I can tell, it's a simpler version of @kongondo's RuntimeMarkup in that it doesn't allow you to use PHP to generate the markup.

Would you mind describing the differences for us please?

 

  • Like 2

Share this post


Link to post
Share on other sites
On 9/9/2018 at 12:43 AM, adrian said:

Would you mind describing the differences for us please?

In fact, these modules are very similar. That's why I did not publish my module in the Processwire module directory.

small differences:

  • I use the builtin InputfieldMarkup
  • I don't use eval()
  • No need to create a new field if used in another template. Simply overwrite the output template based.


The basic usecase is to set the markup field and template/field based. Via string tags all pagefield values and other page properties are accessible. Any textformatter can be applied. Full Language support. For more complex calculations the output is hookable and the full PW API can be used to create the output, not only $page or $pages.

Example:
A page (A) has been assigned to another page (B) via a page field. I want to show some informations about (B) inside (A)

1504697365_Bildschirmfoto2018-09-10um19_43_07.jpg.708f7aea597269e0a12c6d700dec91a4.jpg

 

 

  • Like 7

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. Field widths entered into the Template Field Widths inputfield are only applied if the Edit Template form is submitted with the Template Field Widths inputfield in an opened state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By Macaco
      Hi there, 
      I have two templates that should talk to each other. One is for events which should access a list of artists (eventually add a new artist) and their images related to that event; the second is the artist page, which the user should be able to add or remove events that they participated, also mentioning which images are related to each event.
      Some sort of feedback loop between the two.
      I have tried searching around the community and google, but maybe I'm not formulating the question properly. 
      Thank you all for the amazing work with Processwire and the community support. I have made a few websites with PCW yet I'm still quite between beginner and intermediate.
    • By Robin S
      Thanks to @Macrura for the idea behind this module.
      Page Field Info
      Adds information about options in Page Reference fields. Supports InputfieldSelect and inputfields that extend InputfieldSelect:
      InputfieldSelect InputfieldRadios InputfieldSelectMultiple InputfieldCheckboxes InputfieldAsmSelect Requires ProcessWire >= 3.0.61 and AdminThemeUikit.
      Screenshots
      Field config

      Example of changes to inputfield

      Example of info field filled out in Page Edit

      Installation
      Install the Page Field Info module.
      Configuration
      In the Input tab of the settings for a Page Reference field...
      Tick the "Add info tooltips to options" checkbox to enable tooltips for the options in the field. Tooltips are not possible for Select or AsmSelect inputfield types so for those types you would want to tick the next option. Tick the "Append info about selected options" checkbox to append information about the selected options to the bottom of the inputfield. If the Page Reference field is a "multiple pages" field then the info for each selected option will be prefixed with the option label (so the user will know what option each line of info relates to). In the "Info field" dropdown select a text field that will contain information about the page, to be used in the tooltips and appended info. Of course this field should be in the template(s) of the selectable pages for the Page Reference field. Hook
      In most cases the "Info field" will supply the text for the tooltips and appended info, but for advanced usages you can hookPageFieldInfo::getPageInfo() to return the text. For example:
      $wire->addHookAfter('PageFieldInfo::getPageInfo', function(HookEvent $event) { $page = $event->arguments(0); // The page $inputfield = $event->arguments(1); // InputfieldPage $field = $event->arguments(2); // The Page Reference field $info = $event->return; // Text from the info field, if any // Set some custom text as the $event->return... });  
      https://github.com/Toutouwai/PageFieldInfo
      https://modules.processwire.com/modules/page-field-info/
    • By MarkE
      This post is related to 
      but is a different way of tackling the problem.
      The idea is to use the JqueryUI.module in the front end to present a restricted access admin page in a modal (class pw-modal). However the JqueryUI module doesn't seem to work properly in the front end (I have it working in the back end OK). I'm guessing that this is because the front end page has not loaded all the .js that is needed (that would normally be loaded in the back end). My _main.php loads the following from the core at the moment:
      'wire/modules/AdminTheme/AdminThemeUikit/uikit/dist/js/uikit.min.js' 'wire/modules/AdminTheme/AdminThemeUikit/uikit/dist/js/uikit-icons.min.js' 'wire/modules/Jquery/JqueryCore/JqueryCore.js' 'wire/modules/Jquery/JqueryUI/JqueryUI.js' Any ideas what else I need, or have I got hold of the wrong end of the stick?
    • By gregory
      Hi guys. I need to create a field (link field) that allows me to select the internal pages to use as links. Do you have any suggestions? Thank you.
×
×
  • Create New...