Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Fix issue of multiple date pickers attached to a single date input#972

Closed
ghost wants to merge 1 commit intomasterfrom
unknown repository
Closed

Fix issue of multiple date pickers attached to a single date input#972
ghost wants to merge 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Feb 4, 2011

If there is a date input within a dialog, each time the dialog is shown a new date picker is attached

@johnbender
Copy link
Contributor

mattrq,

What markup is causing this issue for you? Are you manually building the date pickers with a call to datepicker?

In any case thanks for taking the time to submit this request!

@ghost
Copy link
Author

ghost commented Feb 7, 2011

johnbender,

I have marked an input field with type "date" which is with-in a dialog. When the dialog opened the first time it had two date picker calendars attached to the input, each time the dialog was reopened a new date picker calendar was appended. The dialog was defined in a html file along with other pages. There are no js interactions attached to this
dialog apart from the JQM and the experimental Datepicker.

The issue could be indicating that the live event is being triggered to often at JQM level however I have not reviewed the interactions at that level.

Bellow is the full markup for the dialogs definition.

<div data-role="dialog" data-theme="d" id="entry">
    <div data-role="header" data-nobackbtn="true">
        <h1 class="title">Add Entry</h1>
        <a id="save-entry" class="ui-btn-right" data-icon="check" href="#" >Save</a>
    </div><!-- /header -->
    <div data-role="content" data-theme="c">
        <form action="form.php" method="post" id="entry-form">
            <input type="hidden" name="local_id" id="local_id" value="" />
            <div data-role="fieldcontain">
                <label for="title">Title:</label>
                <input type="text" name="title" id="title" value=""/>
            </div>
            <div data-role="fieldcontain">
                <fieldset data-role="controlgroup">
                    <legend>Type:</legend>
                    <input value="Organised Learning" type="radio" name="type" id="radio-choice-1"  />
                    <label for="radio-choice-1">Organised Learning</label>
                    <input value="Personal Learning" type="radio" name="type" id="radio-choice-2"   />
                    <label for="radio-choice-2">Personal Learning</label>
                    <input value="Work Based Learning" type="radio" name="type" id="radio-choice-3"   />
                    <label for="radio-choice-3">Work Based Learning</label>
                    <input value="Other" type="radio" name="type" id="radio-choice-4" />
                    <label for="radio-choice-4">Other</label>
                </fieldset>
            </div>
            <div data-role="fieldcontain">
                <label for="start_date">Start Date:</label>
                <input required="required" type="date" name="start_date" id="start_date" value=""/>
                </div>
            <div data-role="fieldcontain">
                <label for="start_time">Start Time:</label>
                <input required="required" type="time" name="start_time" id="start_time" value=""/>
            </div>
            <div data-role="fieldcontain">
                <label for="hours">Hours:</label>
                <input required="required" type="range" name="hours" id="hours" value="0" min="0" max="8" step="0.5" />
            </div>
            <div data-role="fieldcontain">
                <label for="details">Details:</label>
                <textarea required="required" cols="40" rows="8" name="details" id="details"></textarea>
            </div>
        </form> 
    </div>
    <div data-role="footer" style="display:none">
        <div data-role="navbar">
            <ul>
                <li><a href="" id="delete" data-icon="delete">Delete</a></li>
                <li><a href="" id="duplicate" data-icon="star">Duplicate</a></li>
            </ul>
        </div>
    </div>
</div>

@johnbender
Copy link
Contributor

mattrq,

Wondering if you closed this one by accident?

@ghost
Copy link
Author

ghost commented Feb 8, 2011

Appologies, new to the system. I realise that I must have pressed the comment and close button.

@ghost
Copy link
Author

ghost commented Feb 14, 2011

Found this post on the JQM Forum, Others are having the same issue
http://forum.jquery.com/topic/datepicker-in-jquery-mobile-is-duplicate-when-is-added-in-a-second-page

@johnbender
Copy link
Contributor

fixed multiple date picker caused by unscoped selector, thanks to Matt Rosenquist. Closed by 37d22dd

@johnbender
Copy link
Contributor

Matt,

37d22dd

I applied the above patch to fix this issue. It seemed to boil down to a dom scoped selector that needed to be narrowed to the current page that was being enhanced. Thanks for the submission we appreciate the help!

fcheslack pushed a commit to fcheslack/jquery-mobile that referenced this pull request Jul 28, 2011
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants