Show / Hide Based On Database Field Value - NOT Onclick

Oct 30, 2009

I have created a user form in which visitors can fill in sections, some of which are hidden or displayed using the onclick to trigger a DIV to display or hide then submit the results to a database using ASP. All works fine with that, however... I have created another page which retrieves the results for an individual's form submission, and I want to hide the sections that were not completed (hidden when submitted). How can I get my page to hide or show DIVs, depending on the value retrieved from a particular field within the database? i.e. if Question1Response="A", show Div ID="A Section" If Question1Response="B", show Div ID="B Section" etc.

View 4 Replies


ADVERTISEMENT

JQuery :: (.) Period In Value Field - Show/hide A Div Based Based On The Selection Made Via A Dropdown

Apr 9, 2010

Im using a jQuery script to show/hide a div based based on the selection made via a dropdown.

<script type="text/javascript" src="jquery-1.3.2.min.js"></script>

The problem im having is that the value used in the dropdown lists are price values eg 10.00

Consequently jQuery seems to interprit these as css notations, meaning the code doesnt work.

View 4 Replies View Related

Show/Hide Text And Form Field Based On Drop Down Selection

Jul 20, 2005

I'm trying to show/hide a simple piece of text and a text field on a
form based on what choice is made from a drop down box.

<select name="dropdown" size="1">
<option selected value="">Please make a selection</option>
<option value="1">Choice 1</option>
<option value="2">Choice 2</option>
<option value="3">Choice 3</option>
<option value="4">Other</option>
</select>

i.e. if Choice 2 is selected I'd like to display a new <tr> with the
following:

<tr>
<td>New text field:</td>
<td><input name="newField" type="text size="20"></td>
</tr>

if any other choices are made, I don't want to display anything.
I've tried several onchange() functions but can't achieve what I'm
looking for.

View 6 Replies View Related

Show - Hide Div Based On Cookie Value

Nov 12, 2009

I am trying to finish a script that shows a particular div based on the last 2 chars in the cookie value. I have the cookie part done. how to show hide part.

View 7 Replies View Related

Show - Hide Div Based On Checkbox ?

Aug 21, 2011

I know from scouring the Web that this is a very common Javascript question, but I have a twist on the question which is giving me headaches, and I hope some of the brilliant minds here at DaniWeb can help show me the error of my ways.

Say a user has checked a checkbox when submitting a form. I have a PHP script that records that check in a MySQL record. Later when they visit the page, the PHP script shows the checkbox as being checked. That's all working fine.

Now here's what I'm TRYING to do: Since the checkbox is checked when the page loads, I want a certain div to show up. And when the user UNchecks the checkbox, I want the div to go away. Simple, right?

Here's the Javascript I've placed in the header:

In the CSS, I've styled a div thusly:

And here's what I'm doing in the <body>:

This should show up when you click Yellow Box. And it should go away when you click it again. </div>

When I uncheck the checkbox (first click), nothing happens: the div still shows up.

Then when I re-check the checkbox (second click), the div goes away.

And then when I un-check the checkbox again (third click), the div comes back.

In other words, it's doing the OPPOSITE of what I want.

It seems that when I click the checkbox the first time (to uncheck it), the Javascript pulls an empty value. Only with the second click is it finding a value ('none').

View 3 Replies View Related

Show - Hide A Div Based On A Cookie?

Dec 28, 2009

I have a script I am trying to use to show or hide a div id. It uses a cookie, set on link click, to remember if the div should be displayed or not.

It works, but I'm having two problems:

1) The function only shows/hides the first instance of the div, not all instances.

2) Reloading the page after an initial cookie set causes the div to always initially be displayed regardless of the last cookie value (cookie seems to automatically re-set itself to 'tutor-show').

Here is the code:

You can see it in action here: uomeds{dt}com/cbl/cbl-2.htm

View 1 Replies View Related

Show - Hide Based On Content Within Div

May 6, 2011

I would like to show or hide a header element (e.g. <h3></h3>) based up a div tag that either contains content or not. The content is dynamically added or shown, but the header element isn't, which results in having the header element shown with no content below it many times.

Here's an example:

View 2 Replies View Related

Cookie Based Hide Show Div Tag ?

Oct 17, 2011

I'm basically looking for script that uses hide show functionality. with the addition of save state ability based on a cookie that remembers what item the user last expanded for his/her previous visit.

In other words lets say a user expands a link that has a list of information.

Then the user leaves the page and comes back to the same page. It would be ideal if that page remembers(via cookie) what the user last expanded.

Does ANYONE... know where or can perhaps paste some sample code?

View 2 Replies View Related

Hide / Show Various DIV Based On Function

Aug 6, 2009

I have a script to show and hide various divs based on a function & var. The problem I am having is that when ANY of the variables ('hate', 'ok' and 'love') are passed all 3 different feedback forms ('FeedbackHate', 'FeedbackOk' and 'FeedbackLove') appear, not just the one I want.

Here is the JS:
function sitesurveyswitch(emotion) {
var e = emotion;
document.getElementById('site_survey_hate').style.backgroundPosition = '0px 0px';
document.getElementById('site_survey_ok').style.backgroundPosition = '0px 0px';
document.getElementById('site_survey_love').style.backgroundPosition = '0px 0px';
document.getElementById('FeedbackHate').style.display = 'none';
document.getElementById('FeedbackOk').style.display = 'none';
document.getElementById('FeedbackLove').style.display = 'none';
if (e == 'hate')
document.getElementById('site_survey_hate').style.backgroundPosition = '-80px 0px';
document.getElementById('FeedbackHate').style.display = 'block';
if (e == 'ok')
document.getElementById('site_survey_ok').style.backgroundPosition = '-80px 0px';
document.getElementById('FeedbackOk').style.display = 'block';
if (e == 'love')
document.getElementById('site_survey_love').style.backgroundPosition = '-80px 0px';
document.getElementById('FeedbackLove').style.display = 'block';
}

And here is the code related to this function:
<div id="siteSurveyBox">
<span id="site_survey_hate" onclick="sitesurveyswitch('hate');return false;"></span>
<span id="site_survey_ok" onclick="sitesurveyswitch('ok');return false;"></span>
<span id="site_survey_love" onclick="sitesurveyswitch('love');return false;"></span>
</div>
<div id="FeedbackHate" style="display:none; margin-top:-28px;">
FEEDBACK FORM IS HERE
</div>

<div id="FeedbackOk" style="display:none; margin-top:-28px;">
FEEDBACK FORM IS HERE
</div>
<div id="FeedbackLove" style="display:none; margin-top:-28px;">
FEEDBACK FORM IS HERE
</div>

View 2 Replies View Related

JQuery :: Show / Hide DIV Based On Selected Value Of Tag

May 29, 2010

I have a simple jQuery code that shows or hides a DIV based on the selected value of a select tag. Currently it looks like this and it's working fine:
if (selected == "0") jQuery("#divPublishDate").show('slow')
I want to add an else so that the if the value is anything other than 0, I want to hide the div. What's the proper syntax in this case? I assume this is the short version of an IF statement without the { }.

View 2 Replies View Related

JQuery :: Hide / Show Based On Scroll?

Mar 29, 2010

I've got a fixed div that has a fixed tab as a trigger. I'd like to only show the trigger tab when the user scrolls down the page "X" pixels from the top (say like 200px). Can someone point me in the direction of implementing this?

View 4 Replies View Related

JQuery :: Show/hide Div Based On URL Parameter?

Feb 13, 2010

I have a div that should be hidden on default, but when a certain URL parameter is present, then the div is visible.

[Code]...

View 3 Replies View Related

Show - Hide Div Based On Select Box Choice

Jun 22, 2011

I have a select box where the value must be passed via the form. If the users selects choice B or Choice C then I want a specific div to show. If they choose choice A then I want the div to hide or remain hidden. It should be hidden on page load.

Code:

View 1 Replies View Related

Show/Hide Div Based On Select Box Choice?

Jun 22, 2011

Ok so I have a select box where the value must be passed via the form. If the users selects choice B or Choice C then I want a specific div to show. If they choose choice A then I want the div to hide or remain hidden. It should be hidden on page load.

<select name="Event_Type_ID">
<option value="1">Choice A</option>
<option value="2">Choice B</option>

[code]....

View 2 Replies View Related

Show A Field Based On Another Fields Value?

Mar 9, 2011

I am trying to show a field based on another field's value and hide it it initially... like when you want students to select their schools if they have gone for education ortherwise the school field remains inactive...I have the folowing scipt but it is not being fired on page load...

<script type="text/javascript">
function OnPageLoadAdd(pageid)
{
var tName = 'dbo.Register';

[code]....

View 9 Replies View Related

Hide A Div And Show Another Onclick?

Aug 10, 2009

Alright, me having a very basic knowledge of js I'm looking for some help with(what I think should be) a simple hide/show of a set of divs. I've broken down the ccs/html I'm looking at on a test page here...

The js I have in the page had been what I tried to modify from a simple hide/show, but it's not doing what I want it to do (obviously). The goal is when you click on link 3, I want white3 to hide and all the other white divs to show, when you click on link 3, white 2 will hide and the other white divs will show, and so on. So basically it's revealing what div you click to. A lot of what I've found have been just toggles, but I'm not very confident in my ability to adjust code.

View 7 Replies View Related

Show/Hide Buttons Based On Radio Selection

Jul 20, 2005

I have a form with three radio options. And I have three buttons:

<input type="submit" name="mainform_action" value="Edit Data">
<input type="submit" name="mainform_action" value="View Data">
<input type="submit" name="mainform_action" value="Delete Data">

If the first radio button is selected, I only want all three buttons to be
visible to the user.

If the second radio button is selected, I only want the "Edit Data" and "View
Data" buttons to be visible.

If the third radio button is selected, I only want the "View Data" button to be
visible.

Is it possible to accomplish this in Javascript? In particular, I want to
continue using the "input type=submit" buttons without having to create my own.

View 3 Replies View Related

Show / Hide Content Of Sub Divs Based On Whether Input Is != / =

Aug 9, 2009

how can I show / hide the content of sub divs based on whether the input is != or = and be able to repeat this.I tried to hide the sub divs using , onclick if bla bla = '' ;document.getElementById('hideme').innerHTML = ''; which works, but once I try to enter a new input, then nothing happens, even if the content of the sub divs is = input.

View 2 Replies View Related

Show / Hide Divs Based On POST Value Sent From Another Page

Apr 26, 2011

The two page sections you see on the page "One Time Gift" or "Monthly Subscription" are normally hidden via a document.write via a body onload. Generally, all of this functions well. But, I want to expand the use a bit here so I want to pass a $_POST value to this page from another page which hides or shows these two sections based on this passed value. So, if the value in "once", I want the div with the id="onetime" to be visible and the other div to be hidden. If the value is "monthly", then the opposite would happen. Now this is supposed to all happen as the page loads because we are just arrivng here from the sending page.

View 9 Replies View Related

Show - Hide Div Based On Radio Selection - Prototype

Apr 27, 2010

I have 3 divs that contain radio with labels and beneath each radio button I would like to show/hide a form based on whether the radio is selected or not.

Code idea:

So if the radio1 input is selected this would show form1. Selecting radio2 input would hide any other forms (form1, form3) and show form 2 etc.

View 1 Replies View Related

SHow / Hide Elements Based On Selected Option

Nov 13, 2010

I've tried to find a stright forward script which show/hide specific form fields based on a selected option. I've seen many online but non of them was working with me without the need of some coding or tweeks. Does anyone here have such script?

View 4 Replies View Related

Show/hide Div Based On Radio Button Select

Jul 12, 2007

i would like to have 2 radio buttons each with a associated div when the page loads the first radio button will be checked and its corresponding div will be show when the user checks the other radio button its corresponding div is shown and the first div is hidden:

View 2 Replies View Related

Show / Hide Divs Based On Radio Input

Mar 25, 2010

I'm having some issues with showing / hiding divs in a form based on radio button input. I'm fairly new to JavaScript so I'm still not 100% on what I'm doing... I have a pretty extensive form with quite a few container divs that are set initially to "display: none" and I need them to be set to "display:block" dependent on radio button input.

For this piece, I need the div with id "SFSCPROJSPONCOMP" to be displayed when the user selects the Radio button with name "PROJSPON" and value "COMP".If someone could provide me with JS code for that example, I can get through the rest of this form with ease.

View 2 Replies View Related

Jquery :: Hide / Show Div Based On Radio Class?

Apr 18, 2010

what i have are 3 radio buttons at top of my form, the first radio option i would like if selected to open a div that contains new questions on the form... then if the other radio buttons are selected they hide that div.

View 1 Replies View Related

Show/hide Several Elements Based On List Selection?

Jan 26, 2009

I got a table.Each row has a list of statuses.If status == yes, then several elements will be shown in the rowif status != yes, then hide those elements.Im not sure if I have made a good solution, but it seem to work ok (opera9.6, ff2, ie7)The status selector passes on a unique rowid, and itself. This way the js function can get the row, and the status of the selection. Then toggle various elements in that row.Only annoying thing is the way row elements are named and found. It kinda have to rely on some hard coding, but its ok I guess.Im not sure if its possibel to just call toggle( this ), and that way get to the elements in the row.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

[code].....

View 7 Replies View Related

Hide All Images, And Show Certain Ones ONCLICk?

Jan 30, 2010

I'm new to the forums, so if i post anything wrong let me know. I'm trying to use links to hide all the images, and show just ones from a certain category. I've used the img name attribute to group them and tried to do a function that shows only one img.

<script language="javascript">
function showone(x) {
document.getElementByName('a').style.display='none';
document.getElementByName('b').style.display='none';
document.getElementByName('c').style.display='none';

[Code]...

except the links don't work like they should, and I can't figure out why. I'm an idiot with javascript, so if feel free to make fun of me, and if anyone knows how to get this simple function to work,

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved