boen_robot Posted April 15, 2006 Share Posted April 15, 2006 I know we are not suppose to request full scripts, but I'm really not good with JavaSciprt at all. Besides, what I want is for a friend of mine's site (though I would probably use this as well).So the issue I have is that, if we have (let's say) 4 drop down menus, each containing the same options. Could JavaScript detect a change in one of the menus and change this option from the other menu if it's the one selected?The idea is to have a script for changing different table columns' order. An example- the options in the drop down menus are Date, From, Subject and Title. Each drop down menu if looked without JavaSciprt contains theese in the same order (or not? If it's a requrement for a smooth work, it could be done). If I would like Date to appear second, I would go to the second menu and select Date from it. The script should detect the change and change all other "Date"s to some option which isn't repeated on other fields. If I go to the other fields and select the Date inside them, this would again change the Date from the second dropdown menu to another option which hasn't been yet selected.PHP would be used to verify the data anyway, so this isn't urgnent nor insecure (if the user has turned JavaScript off). It's all for the sake of user's comfort . Link to comment Share on other sites More sharing options...
Chocolate570 Posted April 15, 2006 Share Posted April 15, 2006 I don't understand. Would you like it that if a user picks 'date' in the first box, all the other boxes don't have 'date' in them? :ph34r: Link to comment Share on other sites More sharing options...
boen_robot Posted April 15, 2006 Author Share Posted April 15, 2006 Initially I was thinking about not having them, but if they are removed, this means you won't be able to "change your mind" without submitting the form first. Let's say the menus look like this: |Date| |From| |Subject| |Title| The user changes changes From to Date. At that point, the drop down menus should look like this: |From| |Date| |Subject| |Title| Scince Date was already present as a selection to the first drop down menu, the script should look for something else, it may find Subject and see it's avaiable as a selection inside the third menu, and therefore try something else. The same may be repeated for Title. It then finds From, which is not selected anywhere else, therefore it switches the value of the previously repeated Date to From. Link to comment Share on other sites More sharing options...
Webworldx Posted April 16, 2006 Share Posted April 16, 2006 What about something like:http://www.ifcode.com/javascript/order.htmlOr would you prefer drop down menus? Link to comment Share on other sites More sharing options...
boen_robot Posted April 17, 2006 Author Share Posted April 17, 2006 Well, my friend said it's not going to work, but he wasn't that final either. He'll see it sometime today. Whatever happens, I'm going to stash this script if don't mind. I like it . Link to comment Share on other sites More sharing options...
Webworldx Posted April 17, 2006 Share Posted April 17, 2006 That's okay, glad to be of some help Link to comment Share on other sites More sharing options...
boen_robot Posted April 17, 2006 Author Share Posted April 17, 2006 After a bit of a struggle, my friend was able to implement this script and even added the feature that the submit button isn't acceable until the form is filled .There was an option I suggested which is probably not going to be useful here, but it's going to be on other parts of the forum where this script is going to be used...Is there a way that when the user clicks on a certain filled field, he would demove the numbers from that field and the ones after? Example:Date 1From 2Subject 3Title 4If I wanted to keep the Date first and From second, but I wanted to alrer the order of the other. I can click "reset" but this would mean I would also have to set the previous options as well. Again I say this not tha much urgent nor at this point usefull. Just a thought . Link to comment Share on other sites More sharing options...
Little Goat Posted April 18, 2006 Share Posted April 18, 2006 use this: function undoNum(obj){ if(!obj) return false; var iSpan = obj.getElementsByTagName('SPAN')[0] if(iSpan.innerHTML != "") iSpan.innerHTML = "";} then change the doNum to this: function doNum(obj){ if(!obj) return false; var iSpan = obj.getElementsByTagName('SPAN')[0] if(iSpan.innerHTML != "") undoNum(obj); iSpan.innerHTML = num; num++;} I'm not positive, but that should work. :)LG Link to comment Share on other sites More sharing options...
Webworldx Posted April 18, 2006 Share Posted April 18, 2006 It wouldn't do the numbers after it, and yours would cause the num to go weird. Link to comment Share on other sites More sharing options...
boen_robot Posted April 20, 2006 Author Share Posted April 20, 2006 Trying it with Little Goat's code resulted in the script not working at all. I mean even inital clicks on the unfilled fields didn't worked.Anyway, I just remembered that there's also a need for another more essential for user comfort feature. The different PMs are showing to the user with checkboxes which when marked allow the user to delete the message or move it to another folder (very simmilarly to the thing in IPBs PM system). However, we would really like if the submittion button is only avaiable when there's at least one checkbox checked, instead of loading the server with empty requests.So far there's only a code which makes the button appear if the FIRST checkbox is checked function options(id, id2){ var x = document.getElementById(id); var o = document.getElementById(id2); if (o.checked == 1) { x.style.visibility = "visible"; }else{ x.style.visibility = "hidden"; }} However, the idea is to make it so that if ANY checkbox from the particular form is checked, the button would appear. Note that there would be at least two forms on a page (just saying if it would make a difference) . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now