JQuery :: Updating A Form Based On Checkbox Selection?
Apr 12, 2010
I'm working on a search filter trying to get a form to update itself depending on what options have been checked from a selection of checkboxes. i.e. selecting one checkbox can bring up other checkboxes. It's just posting the form to update_filter.php and putting the updated form into searchNavigation div.
I'm wanting to hide certain divs within a container. If the sub div DOESN'T have a checkbox which is selected in it, then it should be hidden when you click the link. eg: if #2 and #5 checbox only where selected then divs(sub_1,sub_3,sub_4) would be hidden when link was clicked.
I've got the following code snippet in a function to set a coockie based on whether or not the user selects a checkbox. Using an alert the cookie text looks fine but when I go to retrieve the values the only one it can find is the value for user. I've a few different things and none of them seem to work. I'm getting the same thing in both IE and Firefox. The only cookie listed is the 'user' with the proper expiration date. Code:
I have a form with a select field. Depending on what is selected in this field, I want to display or not display another select field. For example first field asks the user if they drive, if the user selects "NO" the form doesn't change. If they select "YES", another field appears with different makes to chose from. If they change back to "NO" the second field dissapears again.
Let me preface this by saying that I have ZERO experience with Ajax, and have simply copied this code from a blog elsewhere. What is shown below ties to a php file that I developed for a search function on our site. As the user enters their search term(s) in the text input field, the div below is populated with potential results through AJAX. I get all that.
However, I'd like to extend this a bit more. I'd like to enable to user to click the Enter key to follow the URL of the top search result automatically, without having to move their mouse and click on it.
Since I'm using PHP to generate the actual URL, I'm sure I can just send this back as a variable via AJAX, but with my lack of understanding, I thought I'd poke around here for some assistance. Can someone show me how to tweak the code below to accomplish what I'm looking for?
I'm less concerned about getting the Enter key to perform the submit than I am about passing the URL variable back to the form via AJAX. I've seen lots of examples of getting the Enter key to behave this way, I just didn't want to muddy up the original code above.
How does one cause a form element to appear ONLY if a certain form selection is made before it?
That is for example say there is a form element of type Radio called "format" so only if they select format value = normal then the form input fields called URL and Name are to appear as the next choices otherwise form input field Group and checklist Places are to appear as the next choices.
I have a form with a drop down list box, few textboxes with labels and submit button. depending upon my selection I should be able to show hide textbox; assume items, 1,3,5 in the selection box shows the items other than the listbox and 2,4,6 items in the selction box if selected hides the labels and textboxes. but in all the case submit button should be present.
I want to have several forms on one page that are not displayed until a selection is made from the category drop down box(select element). The form displayed will depend on the selection made. Here is the code I have so far.
I'm trying to get the two followup questions underneath the checkbox to show up only if someone places a check there, but for some reason the way I've got it set up now it's simply hiding the area I want to show up altogether, and the checkbox has no effect on it.
Rather than waste tons of space pasting it here, here's the pastebin: [url]
Alternatively here is the live version:[url]
I'd prefer to have the form collapse when the additional questions are hidden, though if i can get this working at all.
What I am trying to do is assign a value to unchecked checkboxes. To do this I am running a function upon the submission of a form that checks the boxes for a value, and if they are not checked, assigns a value to them. I though I had it working, but for some reason I am getting a syntax error with the line that contains the "else"
My code is as below. The form name is deleterows and the form is dynamic so there can be any number of checkboxes (hence the for loop). Code:
The user writes some text/figures to a number of text boxes (WMSURL , WMSSRS and so on). When the user pushes the "Compile request" button, it should concatenate all the values to one single strind (and it do). Now comes my problem; the concatenated string should appear in the larger textarea (id=textarea), using the onclick for the Compile request button.
Here's the code (partly):
I have one combo (select) called "uso_buque". Then I have two more combos the first one called "tipo_uso" and the second called "zona_uso". I have a $.ajax call wich make a call to a PHP method. This PHP method based on "uso_buque" selection returns two differents arrays in JSON format. This one for example:
["Pesca con Cordeles","Pesca con Palangre","Pesca con Nasas","Pesca con Chinchorro","Pesca con Filete","Pesca con Redes","No Aplica"] ["MAR TERRITORIAL Z.E.E ORIENTAL","DEPENDENCIAS FEDERALES","AGUAS INTERNACIONES","No Indica"]
Then I need to fill "tipo_uso" with first array data and "zona_uso" with the second one but not know how to do this.
I have a page which has a dropdown box.On selection a value is sent to a php script (Ajax), based on the value a html table is created and sent back to the responseText.The table is outputted to the html page, I want the table to have sortable columns, so I have used jquery datatables for this, but it is not working.I have cut and pasted the exact table into the html and ran the page, and then sorting works.