for example. Now this OPTGROUP would be perfect but it only works one level deep. Can anyone think of an alternative to this, perhaps using javascript which prevents the user from selecting the categories?
I google'd myself silly, I can't find tutorials for this. I hope someone could lend me a hand.
I'll try to make this simple. I have a PHP & MySQL driven site. I have a form for adding new content.
The form has a set of check box options that are pulled from MySQL.
At the bottom of the check boxes there is an "Add New" input field which I want to be used to add new check box options right above it.
database
So as I understand how this should work, when I click in the 'add new' text field, type something in, then press enter - the value of the add new field should be sent to a php script, addnew_backend.php. The form itself should not submit it's data. The PHP script will add the new value to the mysql table of options, and if successful, returns the newley generated checkbox which should fade in right above the add new text field into div#newoptions.
Is it possible to add additional data to the forms plugin options before submitting an ajax form, this would be only setting the data option after setting the main submit options previously in an object?
I have more than once wanted to manipulate the contents of select boxes dynamically, whilst the boxes contain <optgroup> tags. Manipulation of a select box containing only <option> tags is fairly easy and there is plenty of material on the net to assist with this. However, I have searched long and found the material on the subject of <optgroup> to be sparse, with a few posts here & there, but basically you're on your own.
After much trial & error regarding techniques for this, I have a fairly generic solution, which I decided to share, and the code is below. Two different scenarios I have come across are (1) altering the contents of one <select> dynamically depending upon another, and (2) being able click 'up' and 'down' buttons to alter the sequence of the listing (whilst keeping each <option> within its respective <optgroup>) I tried various solutions for both of these which tended to either trash the screen, alter which <optgroup> an <option> was under or trash the <optgroup>s altogether.
Both these situations can be handled with the solution here. Basically I keep the <optgroup>s and <option>s stored in an Array(), and then use the Array() to reconstruct the <select>.
To use, just manipulate the Array() in memory - which I find very easy - and then call the function to reconstruct.
I like to build the <select> <optgroup> <option> set using HTML as normal and then create the Array() with <body as this makes it usable where javascript is unavailable, rather than have the Array() as a hard-coded start point. Code:
My drop down uses an <optgroup label> facility (6 optgroup categories, many values per category).This works fine (when the user chooses a category from the first drop down, a second drop down menu refreshes with the values for that category).HOWEVER, the above system requires me to have every VALUE in plain text on every page. This is no good. It is affecting how the search engines view my page (the text cache version).I want to store these values in a separate file so the search engines do not cache all the values as content on every page.
In a <select> drop-down, the onchange event isn't called when scrolling through the dropdown using the mouse-wheel and when crossing over a new <optgroup>.
Using the example below, notice how the onchange event isn't called when mouse wheel scrolling between A3 and B1, but it works properly when scrolling between A1 and A2.
E.g. ------------------------------------------ <html> <body onload="document.forms['myForm'].elements['mySelect'].focus()">
I want to add more dropdown options which are dependent on previous options. Now I have "hand" and "loft". I want to add next option "model" How to add third dropdown option box?
I want to make few forms but 1 submit button. I want to do 1 page , 5 forms , 1 submit button so when i click on the submit button it will send the 5 forms as 1 form.
Where the inputs sum1 and sum2 are text fields you put whatever numbers you want in. That works fine. Great. Now what I'm having trouble with is modifying the code so that it will add one form with an input number with a form that spits out a randomly generated number.
This is what I'm using for my random number generator. So basically I want to be able to put, say, 5, into the input text field above this. And then click on the d20 button to get a random number, say, 15, and then have the first code add the inputted 5 with the randomly generated 15.
i currently have a few problems with my code, but currently i want to get my options into my function
<select id="menu"> <option value="first">First Time User</option> <option value="Frequent">Frequent Flier</option> <option value="Buying">Buying a Degree</option> </select>
How do I use this info to make it part of my function, for example when First Time user is selected and the function is executed it i want a windows.alert to come up but i don't know how to code that.
I have a bit of a question about CGI...I'm not very knowledgeable about it, so I have a specific question. Can you set up a site in which sites can be rated using CGI?
I've tried to access the value of a selected option through the following getSelectValue function, passing the name of the select
function getSelectValue (name) { var sel = document.getElementsByName(name)[0]; var i = sel.options.selectedIndex; return i == -1? "": sel.options[i].value; }
That dosn't work. I'm just using the title attribute as a place to hold the information I need. Maybe there is another attribute that would work better for this? How can I get the contents of the attribute?
<script> alert("You are not allowed to see this page"); self.location="javascript:history.go(-1)"; </script> The above script has one option. I like to make two options(yes or no) like the following.
Code: <script> alert("Are you sure to delete?"); Yes(self.location="delete.php"); No(self.location="javascript:history.go(-1))"; </script>
I have one select, I can say wich element is selected:
<select name="myselect"> <option value="100">A</option> <option value="101">B</option> <option value="102">C</option> </select> this line will select the option B
myselect.options.selectedIndex = 1; but, how can I do if I want to select the option B without knowing it´s position? I mean, I want to select the option B and the value 101, but I don´t know it´s position
I have a drop down with alot of options say about 6000 cities and districts. I need to select all options if user selects "All checkbox". I use "on change" and a for loop to do this, but it takes a lot of time to select all these options. Is there any faster way to select all these options?
function selectAll() { var element = document.getElementById("location"); var length = document.getElementById("location").length;
I have two drop down box's in a form, how would I go about changing the options of the seccond one depending on what option is selected in the first one?
For example, if there's a drop down box with "a", "b" and "c" as the options, and another drop down box with "1", "2" and "3" as the options; then when you select "a" on the first drop down box the values of the seccond one changes to "a1", "a2" and "a3". This should work for all the options of the first drop down box.
In JS, how can I change the selected value of a dropdownlist(select options) I know the value of indexed value of the selected value before it is changed.
I got this simmple function, It stays on onChange on select and on change it hides all objects with ID equal to select name plus the optionvalue. It works perfectly in Opera and FF, but IE crashes because says that options object is null
the problem is in for (optionId in what.options) It seems that IE does NOT return the list of options, but only some other objects: language scrollheight, istextedit, currentstyle, document, and onmouseup
Please can you help me how can I go throuth that cycle? I need to get the values of all options in select. Thank you
function showHide (what) { selectedId=what.options.selectedIndex; selectedValue=what.options[selectedId].value; selectedObject = document.getElementById(what.name+selectedValue); selectedObject.className=""; for (optionId in what.options) { optionValue=what.options[optionId].value; if (optionValue) { optionObject = document.getElementById(what.name+optionValue); if (optionId!=selectedId) { optionObject.className="hidden"; } } } }
The user must bem select options in this 4 files in order, for example, he must bem select first "First Choice" next "Second Choice"... The options not be same.