Skip to content

Commit bb323e0

Browse files
committed
Add type="button" to buttons to prevent page submit
1 parent 907c50f commit bb323e0

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/DaysView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ var DateTimePickerDays = React.createClass({
1515
tableChildren = [
1616
DOM.thead({ key: 'th'}, [
1717
DOM.tr({ key: 'h'},[
18-
DOM.th({ key: 'p', className: 'prev' }, DOM.button({onClick: this.props.subtractTime(1, 'months')}, '‹')),
18+
DOM.th({ key: 'p', className: 'prev' }, DOM.button({onClick: this.props.subtractTime(1, 'months'), type: 'button' }, '‹')),
1919
DOM.th({ key: 's', className: 'switch', onClick: this.props.showView('months'), colSpan: 5 }, locale.months( date ) + ' ' + date.year() ),
20-
DOM.th({ key: 'n', className: 'next' }, DOM.button({onClick: this.props.addTime(1, 'months')}, '›'))
20+
DOM.th({ key: 'n', className: 'next' }, DOM.button({onClick: this.props.addTime(1, 'months'), type: 'button' }, '›'))
2121
]),
2222
DOM.tr({ key: 'd'}, this.getDaysOfWeek( locale ).map( function( day ){ return DOM.th({ key: day, className: 'dow'}, day ); }) )
2323
]),

src/MonthsView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ var DateTimePickerMonths = React.createClass({
99
render: function() {
1010
return DOM.div({ className: 'rdtMonths' },[
1111
DOM.table({ key: 'a'}, DOM.thead({}, DOM.tr({},[
12-
DOM.th({ key: 'prev', className: 'prev' }, DOM.button({onClick: this.props.subtractTime(1, 'years')}, '‹')),
12+
DOM.th({ key: 'prev', className: 'prev' }, DOM.button({onClick: this.props.subtractTime(1, 'years'), type: 'button' }, '‹')),
1313
DOM.th({ key: 'year', className: 'switch', onClick: this.props.showView('years'), colSpan: 2 }, this.props.viewDate.year() ),
14-
DOM.th({ key: 'next', className: 'next' }, DOM.button({onClick: this.props.addTime(1, 'years')}, '›'))
14+
DOM.th({ key: 'next', className: 'next' }, DOM.button({onClick: this.props.addTime(1, 'years'), type: 'button' }, '›'))
1515
]))),
1616
DOM.table({ key: 'months'}, DOM.tbody({ key: 'b'}, this.renderMonths()))
1717
]);

src/TimeView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ var DateTimePickerTime = React.createClass({
3030
},
3131
renderCounter: function( type ){
3232
return DOM.div({ key: type, className: 'rdtCounter'}, [
33-
DOM.button({ key:'up', className: 'btn', onMouseDown: this.onStartClicking( 'increase', type ) }, '▲' ),
33+
DOM.button({ key:'up', className: 'btn', onMouseDown: this.onStartClicking( 'increase', type ), type: 'button' }, '▲' ),
3434
DOM.div({ key:'c', className: 'rdtCount' }, this.state[ type ] ),
35-
DOM.button({ key:'do', className: 'btn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '▼' )
35+
DOM.button({ key:'do', className: 'btn', onMouseDown: this.onStartClicking( 'decrease', type ), type: 'button' }, '▼' )
3636
]);
3737
},
3838
render: function() {

src/YearsView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ var DateTimePickerYears = React.createClass({
99

1010
return DOM.div({ className: 'rdtYears' },[
1111
DOM.table({ key: 'a'}, DOM.thead({}, DOM.tr({},[
12-
DOM.th({ key: 'prev', className: 'prev' }, DOM.button({onClick: this.props.subtractTime(10, 'years')}, '‹')),
12+
DOM.th({ key: 'prev', className: 'prev' }, DOM.button({onClick: this.props.subtractTime(10, 'years'), type: 'button' }, '‹')),
1313
DOM.th({ key: 'year', className: 'switch', onClick: this.props.showView('years'), colSpan: 2 }, year + '-' + (year + 9) ),
14-
DOM.th({ key: 'next', className: 'next'}, DOM.button({onClick: this.props.addTime(10, 'years')}, '›'))
14+
DOM.th({ key: 'next', className: 'next'}, DOM.button({onClick: this.props.addTime(10, 'years'), type: 'button' }, '›'))
1515
]))),
1616
DOM.table({ key: 'years'}, DOM.tbody({}, this.renderYears( year )))
1717
]);

0 commit comments

Comments
 (0)