Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable save button when nothing slected. fixes #1322 #1326

Merged
merged 2 commits into from
Mar 9, 2016

Conversation

knight-of-ni
Copy link
Member

Fixes #1322 on my machine. Please test.

@connortechnology
Copy link
Member

Um.. what is element.selected? This is not standard DOM as far as I know. Is it a jquery thing?

Seems to me it should be element.selectedIndex and we should be able to test for >= 0 (-1 means no selection).

@knight-of-ni
Copy link
Member Author

I'm just winging this php stuff.

I noticed that the selected property was being set for each monitor here:
https://github.com/ZoneMinder/ZoneMinder/blob/master/web/skins/classic/views/group.php#L70

I'm not entirely sure that "if" condition even needs to be in there. I left it in there because it seemed to work on my demo system.

@connortechnology
Copy link
Member

Oh... the option element has a selected property... but not the select element.
if ( element.selectedIndex >= 0 ) {

can you try that and see if it works?

@knight-of-ni
Copy link
Member Author

sure. give me a sec.

@knight-of-ni
Copy link
Member Author

Ah no, that does not work. The button never enables when I use if ( element.selectedIndex >= 0 ) or even if ( element.selectedIndex )

What does work, is removing that if condition altogether.

@knight-of-ni
Copy link
Member Author

The behaviour we are looking for seems to be similar to this:
https://github.com/ZoneMinder/ZoneMinder/blob/master/web/skins/classic/views/js/monitorpreset.js#L10

Since that is not checking element.selectedIndex , I'll just go ahead and remove the the if condition.

@connortechnology
Copy link
Member

Yeah, after reading modern DOM docs... select.value should work just fine.

connortechnology added a commit that referenced this pull request Mar 9, 2016
disable save button when nothing slected. fixes #1322
@connortechnology connortechnology merged commit d51d95c into ZoneMinder:master Mar 9, 2016
@knight-of-ni knight-of-ni deleted the fixGroupSaveBtn branch December 23, 2016 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants