Solved

App Has Period?

Posted on 2015-02-19
2
55 Views
Last Modified: 2015-02-21
I have never seen anything like this. When I add a child record to my main form, the Birthdate field loads with a period in the input box. I have no idea how this is happening. Has anyone in this community seen anything like this? What could be causing it? I promise this is NOT a spoof or joke.

HTML
<input name="Birthdate" class="form-control input-sm" data-bind="attr:{'id': 'Birthdate_' + $index()}, value: Birthdate, date: Birthdate, format: 'MM DD YYYY', event: {change: flagIndividualsAsEdited}" placeholder="Birthdate"/>
                        </td>

Open in new window


JS function adding child viewModel and defaults.
        self.addFamilyMember = function() {
            var individuals = new IndividualsViewModel({ Id: -1, FirstName: "", MiddleName: "", LastName: "", Gender: "", PhoneNumber: "0000000000", Email: "", Birthdate: "", AdultBirthdateDecline: 0, Ethnicity: "", USTANumber: "", FamilyRole: "", RelationshipType: "", ObjectState: ObjectState.Added });
            self.Individuals.push(individuals);
        },

Open in new window


THE DEMON PERIOD!
Input form with random period in Birthdate field.
0
Comment
Question by:wdarnellg
2 Comments
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 40622003
That's not a period...that's a hyphen.  It looks like you are using a library to enforce a particular formatting on the value of that input box (date formatting, probably).  The hyphen could be an artifact of the library trying to format a NULL value into a date.  Or perhaps the library properly detects the NULL value, and purposefully inserts the hyphen to signify it.

In any case, you'll need to look through the library manipulating that input.
0
 

Author Comment

by:wdarnellg
ID: 40622993
That was it. It was this part code that formats the date:
       var value = valueAccessor();
            var pattern = allBindings.format || "MM/DD/YYYY";
            var valueUnwrapped = ko.utils.unwrapObservable(value);

            var output = "-";
            if (valueUnwrapped !== null && valueUnwrapped !== undefined && valueUnwrapped.length > 0) {
                output = moment(valueUnwrapped).format(pattern);
            }
            if ($(element).is("input") === true) {

                $(element).val(output);
            } else {
                $(element).text(output);
            }

Open in new window


Thanks for the insight!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question