Jump to content
adrian

Phone Number Fieldtype

Recommended Posts

What version of FieldtypePhone did you initially install? Was it before the update that I mention in post #25 above?

Does saving the module's config settings fix the error?

Share this post


Link to post
Share on other sites

What version of FieldtypePhone did you initially install? Was it before the update that I mention in post #25 above?

Does saving the module's config settings fix the error?

  • 1.0.8/ no
  • yes

Share this post


Link to post
Share on other sites

I am having trouble figuring out why this would happen. When I install the module the config setting are automatically populated to the modules DB table. 

If you have a minute would you mind uninstalling and reinstalling and see if the error shows up again, and also post the contents of the data field from the modules DB table.

Thanks!

Share this post


Link to post
Share on other sites

No troubles any more. Maybe there where some old settings stored, because I used an older version of that field before. Its working fine after uninstalling/reinstalling.

  • Like 1

Share this post


Link to post
Share on other sites

I have a problem setting the field as mandatory. I get allways a warning that its not set.

Hi @Spica,

Interesting that no-one has reported that until now :)

Anyway, it should be fixed in the latest version. Please let me know how it goes for you and thanks for the report.

BTW - I made it so that only the "number" portion of the field is considered for the required check.

Share this post


Link to post
Share on other sites

Yes, was confused about that too and first tested for an installation problem. But now its working. Thanks.

Btw. I changed the input type to

type='text' pattern='[0-9]*'

as the type number does not allow a leading zero (which is necessary for me) and has this up and down ticks, that do not make sense to me for telefonenumbers. This makes updating harder in future. Mayby the input type is selectable in a next version?

Share this post


Link to post
Share on other sites

Next Problem. Have this output Format

{+[phoneCountry] }{([phoneAreaCode,0,0]) }{[phoneAreaCode,1,5] }{[phoneNumber]}{–[phoneExtension]}

it should give e.g.

+49 (0) 30 1111-22

but actually gives

+49 30 1111-22

The Mobile (unformatted) output should give

+4930111122

and not

+49030111122

How to handle that best way?

Share this post


Link to post
Share on other sites

@Spica,

I have changed the number format to text with that pattern - I don't really see any downsides at the moment. So that should handle you leading zero issue.

As for the format option. I don't really understand what you expect:

{([phoneAreaCode,0,0]) }

to return. PHP substr() won't return anything with this because you are starting at 0 and returning 0 characters. Does that number always need to be: 0 or will it be different?

Perhaps you could also provide with with the numbers you entered in each phone component to get the results you are getting?

I am also confused about your use of the extension component. At least where I am from, this is not something that is dialed initially, but is entered after the call has been connected to get a certain phone is an office. Note the other example formats where I split the main number component into parts either side of a dash. Is this what you are trying to achieve.

I haven't looked at this module in a while, but I am thinking that perhaps I should make it possible to set the format for each phone field, rather than in the config settings with a user override. I think a dev override in the field settings might be more useful - this would allow for different formats for landline vs mobile(cell) numbers. Any thoughts?

Share this post


Link to post
Share on other sites

Your right, my mistake in transcription. Should be

{([phoneAreaCode,0,1]) }

But it seems, that the single 0 is interpreted as a non value.

It is for German city codes, that start always with a 0. So there is a notation convention to note the 0 in brackets, if the country code is also notated. A call within Germany needs the leading 0. A call with the country code dialed first makes it obsolete, so I need to supress it for the unformatted output.

I could put the 0 into the pattern, but this may confuse users with the input as they my try to note the 0.

The extention code is also dialed directly and leads from the main connection to certain phones/offices and is divided by a divice, but dialed in once with the whole number. The divice is only a visual hint. As it is not standarized how many numbers a mainline and a extension has, I cant divide it by a pattern but need the fields.

So my main problem right now is how to get the leading 0 and I would be able to note my numbers. It only has to do with the local notation convention. For mobile numbers you can already disable the extension in the field settings, or just leave it out. But I thought maby us the field as a repeatable field, so it would be nice to chose the format for each entry while input it?

Share this post


Link to post
Share on other sites

Thanks very much for the detailed explanation about German phone formats, especially the leading (0) and also the extension - very helpful.

I have fixed the bug with the "(0)" not being displayed - please let me know if the new version works for you now.

But I thought maby us the field as a repeatable field, so it would be nice to chose the format for each entry while input it?

If I understand you correctly, this is already possible - go to the phone field setting's Input tab and check "Output Format Override" - this will give your site editors the ability to choose from the available formats as defined in the config settings. I think I will also look into having that option for the developer to set the format per field as well though.

Share this post


Link to post
Share on other sites

Thanks, adrian,

version works now for me very well.

I already noticed the output format override, which already would be a good solution. But I thought of more convenience for users not to even get a extention input field when they want to add a cell number. Dont know if this anyhow makes sense.

Share this post


Link to post
Share on other sites

version works now for me very well.

Great!

I already noticed the output format override, which already would be a good solution. But I thought of more convenience for users not to even get a extention input field when they want to add a cell number. Dont know if this anyhow makes sense.

What about the field specific "Extension: (Whether to ask for extension when entering phone numbers.)" checkbox - uncheck that to remove the extension input? I guess the problem is with using this in a repeater because you are using the same field. I guess the new Repeater Matrix pro field would be a good solution. Otherwise you could use a PageTable field, but obviously not as nice of a UI for this.

Share this post


Link to post
Share on other sites

Havent used the Repeater Matrix pro yet. PageTable seem too make the gui more complex as needed. Checkbox would be nice to toggle the extension on/off. But ist not a must have.

Share this post


Link to post
Share on other sites

I have just added the option to define the phone output format on the Input tab of each phone field's settings. This should make it much nicer if you have separate fields for landline and mobile numbers, etc.

Share this post


Link to post
Share on other sites

Oh, I ve forgotten the cell output which needs the leading 0 stripped for an autom. call. Can do it in the template or do you see an adaption into your module?

will check the new version immediately.

Share this post


Link to post
Share on other sites

Oh, I ve forgotten the cell output which needs the leading 0 stripped for an autom. call. Can do it in the template or do you see an adaption into your module?

I think this might best be handled in your template as getting into having multiple formatted versions for each phone field in the module might get a little out of control.

All you would need to do is build the number like this:

$automaticDial = '+' . $page->phone->country . ' ' . ltrim($page->phone->area_code, "0") . $page->phone->number;

Or something like that - I am sure you get the idea :)

  • Like 1

Share this post


Link to post
Share on other sites

I am continuously getting the same error flagged.

Notice: Trying to get property of non-object in /home/djverde/public_html/site/modules/FieldtypePhone/InputfieldPhone.module on line 140

Fatal error: Call to a member function set() on a non-object in /home/djverde/public_html/site/modules/FieldtypePhone/InputfieldPhone.module on line 145

Do you have any ideas what I could be doing wrong. I have checked again and again, re-read the documentation countless times. Still can not see what I have done wrong.

If you need any more information let me know.

I have just today updated to the latest version and the issue persists.

Share this post


Link to post
Share on other sites

Hi @MikeB,

Sorry that you are seeing those errors. I can't figure out why here at the moment. I could add a check to make sure that $value is an object before the code on lines 140 and 145 is processed, but I would like to be able to replicate what you are seeing first. Presumably you are getting this error when saving a page with this template in the admin? Is the phone field in a normal template, or is it part of repeater, or some other combined field situation?

Let me know more and I am sure this will be an easy fix.

PS - I am on the road at the moment, so forgive me if my responses are delayed.

Share this post


Link to post
Share on other sites

I have used the field in a formbuilder form.

I get the error if I complete the field on submission of the form.

If I leave the field blank (It is optional) I get no error.

Hope this helps you track it down.

Anything else I can send you to aid in debugging?

Share this post


Link to post
Share on other sites

I believe that FormBuilder is not compatible with every Fieldtype and that may be the cause of your problem. 

  • Like 2

Share this post


Link to post
Share on other sites

I believe that FormBuilder is not compatible with every Fieldtype and that may be the cause of your problem. 

Mike - I am not a FormBuilder user so I am not sure if this is a FB issue or if there is something that I can change in the Phone fieldtype to make it work with FB. Perhaps if you post about this in the FB thread, Ryan might have some advice.

Share this post


Link to post
Share on other sites

I have a problem with the " Extension-Field".

I can not save a single "0" as extension. When i enter a single 0 and save the page the field is empty. Any other number works as expected even when i enter "00" but a single "0" is not saved.

Here in germany many phonenumbers use a single "0" as extension:

Example:

Phone: +49 (421) 123456 - 0
Fax: +49 (421) 123456 - 1

  • Like 1

Share this post


Link to post
Share on other sites

Hi @Roman Schmitz - sorry about that!

I will commit a fix a little later (I want to clean up some other stuff while I am at it), but for now please change: https://github.com/adrianbj/FieldtypePhone/blob/56ec89e7fc81cdc693ce72f9f9030edf3f49bd63/FieldtypePhone.module#L159

to:

if($value['data_extension'] != '') $pn->extension = wire('sanitizer')->text($value['data_extension']);

 

  • Like 4

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 Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.56
      Composer: rockett/jumplinks
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy! :)
    • By BitPoet
      As threatened in Ryan's announcement for 3.0.139, I built a little module for sliding toggles as a replacement for checkboxes. Styling of the input is CSS3 only (with all the usual caveats about older browsers), no JS necessary, and may still be a bit "rough around the edges", so to speak, since I didn't have much time for testing on different devices or brushing things up enough so I'd feel comfortable pushing it to the module directory. But here's the link to the GitHub repo for now:
      InputfieldSlideToggle
      Fieldtype and Inputfield that implements smartphone-style toggles as replacement for checkbox inputs. The visualization is CSS-only, no additional JS necessary.
      Status
      Still very alpha, use with caution!
      Features / Field Settings
      Size
      You can render the toggles in four different sizes: small, medium, large and extra large.
      Off Color
      Currently, "unchecked" toggles can be displayed either in grey (default) or red.
      On Color
      "Checked" toggles can be rendered in one of these colors: blue (default), black, green, grey, orange or red.
      Screenshots

      Some examples with checkbox label


      View all Size and Color Combinations
      Small toggles Medium toggles Big toggles Extra big toggles  









    • By Orkun
      Hi Guys
      I needed to add extended functionalities for the InputfieldDatetime Module (module is from processwire version 2.7.3) because of a Request of Customer.
      So I duplicated the module and placed it under /site/modules/.
      I have added 3 new Settings to the InputfieldDatetime Module.
      1. Day Restriction - Restrict different days based on weekdays selection (e.g. saturday, sunday) - WORKING

       
      2. Time Slots - Define Time slots based on custom Integer Value (max is 60 for 1 hour) - WORKING

       
      3. Time Range Rules per Weekday - Define a minTime and MaxTime per Weekday (e.g. Opening Hours of a Restaurant) - NOT WORKING PROPERLY

       
      The Problem
      Time Slots and Day Restriction working fine so far. But the Time Range Rules per Weekday doesn't work right.
      What should happen is, that when you click on a date, it should update the minTime and maxTime of the Time Select.
      But the change on the select only happens if you select a date 2 times or when you select a date 1 time and then close the datepicker and reopen it again.
      The time select doesn't get change when you select a date 1 time and don't close the picker.
      Here is the whole extended InputfieldDatetime Module.
      The Files that I have changed:
      InputfieldDatetime.module InputfieldDatetime.js jquery-ui-timepicker-addon.js (https://trentrichardson.com/examples/timepicker/) - updated it to the newest version, because minTime and maxTime Option was only available in the new version  
      Thats the Part of the JS that is not working correctly:
      if(datetimerules && datetimerules.length){ options.onSelect = function(date, inst) { var day = $(this).datetimepicker("getDate").getDay(); day = day.toString(); var mintime = $(this).attr('data-weekday'+day+'-mintime'); var maxtime = $(this).attr('data-weekday'+day+'-maxtime'); console.log("weekday: "+day); console.log("minTime: "+mintime); console.log("maxTime: "+maxtime); var optionsAll = $(this).datetimepicker( "option", "all" ); optionsAll.minTime = mintime; optionsAll.maxTime = maxtime; $(this).datetimepicker('destroy'); $(this).datetimepicker(optionsAll); $(this).datetimepicker('refresh'); //$.datepicker._selectDate($(this).attr("id"),date); //$.datepicker._base_getDateDatepicker(); // var inst = $.datepicker._getInst($(this)); // $.datepicker._updateDatepicker(inst); /*$(this).datetimepicker('destroy'); InputfieldDatetimeDatepicker($(this), mintime, maxtime); $(this).datetimepicker('refresh'); */ // $(this).datetimepicker('option', {minTime: mintime, maxTime: maxtime}); } } Can you have a look and find out what the Problem is?
      InputfieldDatetime.zip
       
      Kind Regards
      Orkun
    • By teppo
      This module tracks changes, additions, removals etc. of public (as in "not under admin") pages of your site. Like it's name says, it doesn't attempt to be a version control system or anything like that - just a log of what's happened.
      At the moment it's still a work in progress and will most likely be a victim of many ruthless this-won't-work-let's-try-that-instead cycles, but I believe I've nailed basic functionality well enough to post it here.. so, once again, I'll be happy to hear any comments you folks can provide
      https://modules.processwire.com/modules/process-changelog/
      https://github.com/teppokoivula/ProcessChangelog
      How does it work?
      Exactly like it's (sort of) predecessor, Process Changelog actually consists of two modules: Process Changelog and Process Changelog Hooks. Hooks module exists only to serve main module by hooking into various functions within Pages class, collecting data of performed operations, refining it and keeping up a log of events in it's own custom database table (process_changelog.) Visible part is managed by Process Changelog, which provides users a (relatively) pretty view of the contents of said log table.
      How do you use it?
      When installed this module adds new page called Changelog under Admin > Setup which provides you with a table view of collected data and basic filtering tools See attached screenshots to get a general idea about what that page should look like after a while.
      For detailed installation instructions etc. see README.md.
       


    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




×
×
  • Create New...