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
      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.
    • By Hubris
      Hi there!
      I'm using some page reference fields to create lists of tags, categories, years, etc.. I'm able to find the pages like so:
      $pages->find("template=project, {$filter}={$page->title}"); Which dynamically does something like: 
      $pages->find("template=project, tags=Experimental"); Only if the value (the page name, like "Experimental") starts with letters. If it starts with numbers, find returns nothing.
      Why is this and how can I fix it?
    • By eschoonen
      I'm working on the threaded comments on my website and for this I need to include the comments.js
      When I do this it keeps on giving me the "Uncaught ReferenceRrror: jQuery is not defined". Whatever I do it keeps giving me this error message.
      It's the last javascript file that I load in. So how do I fix it?
×
×
  • Create New...