Hide/unhide Fields Depending Upon Other Fields?

Apr 26, 2009

i have to hide/unhide some fields on basis of some other fields. i found this script on the web.i can't understand the function completely what is the if ( txt.match(id1) ) block doing ?? is there any other way of doing the same...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

[Code]...

View 9 Replies


ADVERTISEMENT

Hide/unhide Multiple Form Fields With Checkbox?

Feb 15, 2011

I have a form with a shipping address area and a billing address area. Right now I have a checkbox that fills in the billing address information if its the same as shipping information. Instead of having that so the form isnt so long when people first look at it I would like for the billing address fields to be hidden when you first come onto the page, and only if the address's are different the person will click the check box and the billing address section will appear. I know this has to be done in javascript but I have never done it

View 14 Replies View Related

Hide Fields Depending On Selection

Sep 1, 2009

In the following code I am attempting to get certain fields to only appear if the user Selects dependent else those fields should be hidden.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"[URL]">
<html xmlns="[URL" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Display and Hide</title>
<script language="JavaScript">
function showhidefield(){
if (document.HelpAdd.RecordType.value == "Parent"){
document.getElementById("hideablearea").style.visibility = "hidden";
} else {
document.getElementById("hideablearea").style.visibility = "visible";
} }
</script>

</head>
<body>
<form name='HelpAdd' action='nextpage.asp'>
<table align="center" border="3" cellspacing="0" cellpadding="3">
<tr><td>Record Type:</td>
<td><select id="RecordType" name="RecordType" onchange=showhidefield()>
<option value='0'>Parent</option>
<option value='1'>Dependant</option><br/>
<tr><td>Topic Title:</td>
<td><input type="text" name="TopicName" ID="TopicName" maxlength="25"></td></tr>

<div id='hideablearea' style='visibility:hidden;'>
<tr><td>Parent:</td>
<td><select name="Parent">
<input type="text" name="ParentID" ID="ParentID" maxlength="25"></td></tr>
<tr><td>Topic Body:</td>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $MaxFileSize ?>" />
<td><input id="helpfile" name="helpfile" type="file" /></td></tr>
</div>
<tr><td colspan="2" align="center">
<input type="submit" name="submit" value="Submit">
<a href="/help.php"><button>Back</a>
</td></tr>
<tr><td colspan="2" align="center">
<?php echo $Message ?>
</td></tr>
</table>
</form>
</body>
</html>

View 4 Replies View Related

Show / Hide Form Fields Depending On Radio Button Selection

May 29, 2005

How to show and hide form fields depending on a selected radio button.

View 14 Replies View Related

Extracting Fields From A Db Depending On The Number Of Fields?

Jan 7, 2011

I have used this piece of code which is working great. It allows me to add different items from combo boxes to my order form. The problem is that i dont know how to extract the data from my db to display in a form view when i want to amend the i.e the number of items. Each record has a different number of items in it but are all lnked to one id. Is this possible to do. Any help on this would go along way.

stdhead("Home");
?>
<script type="text/javascript">
var counter = 0;
function add_phone() {

[Code]...

View 9 Replies View Related

Display Specific Input Fields Depending On Combobox Selection?

Nov 5, 2009

Within a classic asp webform (using vbscript) I would like part of the form (input boxes within table structure) to be specific/displayed depending on the users selection from the combo box in the row above.

I think the best solution would be using Javascript can anyone suggest a solution or example code?

View 1 Replies View Related

JQuery :: Variable Validation Rules For Same Input Field Depending On Other Fields

May 30, 2009

I have the following html, field xxx requires a number from 0 to 100 when percentage is selected, and 0 to inifinity when dollar is selected.what's the best practice to setup validation for this?the key is to control the maximum value.I have tried depends expression in a max rule, but it doesn't seem that it can satisfy my requirement.

View 1 Replies View Related

JQuery :: Validate: Check Certain Form Fields Depending On Button Pressed?

Feb 4, 2011

I have a form with a series of fields. Only certain fields need to be validated when certain buttons are pressed. The reason for this is mainly because I had to build my own wizard style setup with jquery so, even though it's one big form, only certain bits need to be checked as they progress. I tried to tweak the accordion example given by the creators but it can't really apply to my scenario.

I've simplified the code down a bit and it is behaving exactly the same way as the big form...which is to say it's not behaving at all.

In this code, I want it to only validate field txt1 if button 1 is pressed and text2 if field 2 is pressed. One odd thing to note, when I set it up exactly as the site recommended with one big mass validation and such, it would only acknowledge the existence of the first field even though they both had class="required" on them.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head >

[Code].....

View 2 Replies View Related

Add And Delete Form Fields BUT A Textarea Or A Section Of Input Fields

Oct 11, 2006

I have been looking for the past 2 days for a script that I can add and delete table rows.

I have found a lot but so far all of them add an input field but I desperatly need a textarea or ideally a section of input fields.

I have tried to change the code from input to text area but none of them worked.

Have you come across to a similar script.

I would appreciate any contributions.

What I am trying to do is a page where the user will add their employees details so we can order business cards for them. So I have fileds such as, Name, Tel Num, Email, Cell etc.

View 4 Replies View Related

Order Form Change Text Fields With Select Fields

Jan 24, 2011

I have this order form where the customers can change the quantity by intput in a text field.I would like to have the text field changed with select fields, but doing so in the form, the script is not doing anymore.Can anyone have a look and tell me what to change in the scritp to accept select fields in place of the text fields.

View 5 Replies View Related

Netscape Hidden Fields - Array - Multiple Fields With Same Name

Jul 20, 2005

I have multiple fields in a form with the same name. Lets call the fields with the same name "junk_array". My first field of junk_array is a input type=hidden. All the others fields in junk_array that follow are type=text. I can reference this first hidden field in IE with document.form.field[0].value. In, fact my form works absolutely wonderful in IE 6. However, netscape 4.7 does not recognize my first field in the array as the hidden field. Netscape sees the first visible text field as the first field in the array, subscript 0. What totally and utterly perplexes me, is that, from a previous thread, I can do this and get 9999 back in an alert
box in Netscape and IE. So, this proves Netscape doesn't have some evil code that disregards hidden fields. I guess...

<body onload="alert(document.myForm.test[0].value);">
<form name="myForm">
<input type="hidden" name="test" value="9999">
<input type="hidden" name="test" value="8888">
<input type="text" name="test" value="6">
<input type="text" name="test" value="3">
</form>

I even copied these fields directly below the opening <form> tag in my form and both Netscape and IE see the first hidden field as as
subscript 0.

However, my form is much more complicated. I have tables within tables and about 30 other fields. In my form I cannot for the life of me get Netscape to recognize the first hidden field of junk_array to zed as index 0.

Somehow, If I make the first type=hidden fields visible, netscape does work nicely. Why when I toggle type=hidden to type=text does Netscape cooperate. What is happening here? Anyone else have this problem with hidden fields in Netscape? I could post the code to my form but it is
big.

View 1 Replies View Related

Show And Hide Form Fields?

Mar 23, 2011

I have a drop down selection where it shows and hides form inputs depending on selection. When the page loads it shows the drop down selections with no form inputs. After user selects drop down it shows the form fields. It works great but I want it to show the same form fields after the user hits the submit button which submits the page to itself. It currenlty goes back to the default selection list and doesnt show any of the form fields. Basically it hides all the form fields after the user hits submit button. How do I make it keep the last shown form fields after the user hits the submit button?

test3.html looks like this:
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Show/Hide</title>
<script type="text/javascript">

[Code]...

View 17 Replies View Related

Hide Fields When Checkbox Clicked

May 24, 2010

I have put the following code into a sharepoint aspx page. So that when I change the value in a drop down box it runs a function (in this case it displays "Works").

<script language="javascript" type="text/javascript">
function getField(fieldType,fieldTitle) {
var docTags = document.getElementsByTagName(fieldType);
for (var i=0; i < docTags.length; i++) {
if (docTags[i].title == fieldTitle) {
return docTags[i]
}}}

function TestFunctionName() {
alert("Works");
}
getField('Select','DropDownBoxName').onchange = function() {TestFunctionName()};
</script>

What I'd like to be able to do as well is when a check box is changed or clicked on the same thing happens. I dont seem to be able to achieve it though. I've change the line...
getField('Select','DropDownBoxName').onchange = function() {TestFunctionName()};
to...
getField('Input','CheckBoxName').onchange = function() {TestFunctionName()};
and
getField('Input','CheckBoxName').onclick = function() {TestFunctionName()};

View 3 Replies View Related

Display/Hide Fields Using Radio Buttons

Jul 23, 2005

I would like to be able to display or hide fields based on whether a
specific Yes/No radio button is selected. This is in conjunction with
a posting a just made here in the same group related to checkboxes.

View 10 Replies View Related

JQuery :: For Statement To Show / Hide Fields

May 4, 2011

I'm trying to use jquery to hide some contents in a for statement but is not working. Here is the code

if( $total_attachments > 0 ) {
for ($i=0; $i < $total_attachments; $i++) {
//output div and image in it
echo '<div class="pictures_entry">';
echo '<a href="'.$attachments[$i]["location"].'" title="'.$attachments[$i]["title"].'" rel="prettyPhoto[gallery]"><img src="'.$attachments[$i]["location"].'" width="128" height="120" alt="'.get_the_title().'" /></a>';
echo '<div id="pictures_entry_name_'.$i.'">';
echo '<h6>'.$attachments[$i]["title"].'</h6></div>';
echo '</div>';
}}?>

I want to hide the pictures_entry_name_'.$i. and when a user clicks on a picture <a href="'.$attachments[$i]["location"].'" title="'.$attachments[$i]["title"].'" rel="prettyPhoto[gallery]"><img src="'.$attachments[$i]["location"].'" width="128" height="120" alt="'.get_the_title().'" /></a>,
I want to slide down the pictures_entry_name_'.$i of this picture.

View 5 Replies View Related

Form With Radio Buttons To Hide Fields?

Feb 12, 2011

I have a form which has two radio buttons at the beginning which show and hide fields depending on what button is clicked:

I want to adapt this js and html code so that when the page loads it checks whether one of the two radio buttons is clicked and depending on that it displays/hides the divs which are declared in the current function, at the moment it performs this when the user clicks one of the radio buttons but I want to perform it when the page is loaded and also when the user first enters the page I want the yes radio button to be selected and obviously show/hide

[Code]...

View 5 Replies View Related

Javascript Code To Hide/display Entry Fields On A Form

Jul 23, 2005

I am looking for a general purpose javascript snippet that enables me to
<div> or <span> HTML to make portions of the form be hidden and then appear.
The form contains about 12 sections and some sections can contain
subsections. When the user clicks on a checkbox, I want previously hidden
text boxes, radio buttons, text, drop down menus, and additional checkboxes
to appear. In some cases, clicking on a checkbox in a section can cause
additional previously hidden text boxes, radio buttons, text, drop down
menus, and additional checkboxes to appear.

Within each section, a list of individual names is displayed with an initial
checkbox beside each name being displayed. Clicking the checkbox beside a
name is what triggers the hidden info to be displayed. The server side
application is written in php and the field names are assigned using
brackets as the array is created. As an example the HTML checkbox beside
the first name <input type='checkbox' name='sect1custname[1]' value'First
Name'> The HTML for the next name woud be exactly the same except the name
field would be defined as name='sect1custname[2]'. All of the other input
buttons, boxes, menus, and text would use the same naming conventions so
that the server side module can correctly process the data.

I am hoping to keep this as generic as possible so that we can add, change,
and/or delete entire sections simply by creating the appropriate HTML and
surrounding it with the correct <div> or <span>. I understand that there
may need to be some javascript wrapped around the checkboxes.

If you know of , or have, or can develop the code, please send particulars
to jscott4272 at comcast dot net. If there are any costs associated with
the code, just let me know what they are. If you have any questions or need
additional information, please email them to me.

View 2 Replies View Related

JQuery :: Show Hide Multiple Other HTML Input Fields

Mar 1, 2010

I am having some jQuery troubles whereby I have some jQuery that toggles an 'Other' HTML input field and associated label when a user selects the value Other from a HTML select drop down. I have this working for one field but the application I am building has increased in scope whereby there may be multiple instances of members on one page so the Other option will be there multiple times. At the moment if a user selects Other from one drop down all Other input fields show. How do I make this exclusive without repeating the jQuery for the separate instances?

// Show/Hide 'Other'
$(document).ready(function() {
$('.jOther').hide();
$('.jTitle').change(function() {
var $index = $('.jTitle').index(this);
alert($index);
if($('.jTitle').val() != 'Other') {
$('.jOther').hide();
} else {
$('.jOther').show();
window.location.hash = 'Other' + $index;
}});
});
<td>
<select id="title" class="inlineSpace jTitle">
<option value="Please select">Please select...</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Dr">Dr</option>
<option value="Other">Other</option>
</select>
<label for="other" class="inlineSpace jOther">Other</label>
<input type="text" class="text jOther" name="other" id="other" maxlength="6" />
</td>

View 1 Replies View Related

JQuery :: Simple Hide And Show - Dynamic Input Fields

Jul 29, 2009

For example I have this sort code:
for ($i=0;$i<$db;$i++) {
$t1="toggleh$i";
echo "<div class='c'>Test<input name='$t1' type='image' id='$t1' src='test.png'/></div> <br>";
}
I try to make clear the screen for users, so I use hide & show to hide some row on screen what users actually don't need...

The JS part of code is something like this:
$('#toggleh0').click( function() {
$('div.showhide').toggle(400);
});
$('#toggleh1').click( function() {
$('div.showhide').toggle(400);
});
$('#toggleh3').click( function() {
$('div.showhide').toggle(400);
});
.
.
.
I dont know how can do this dynamic. So if "$i=6;" then I need toggle 0-6 function...

View 12 Replies View Related

Show - Hide Form Fields Based On Checkbox State

Mar 4, 2010

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.

View 2 Replies View Related

Show - Hide Dropdown - Script To Work In Multiple Select Fields?

Jun 26, 2009

I am using the following script on one of my pages (script comes from [url]:

Code:

The script works great, BUT I need to use it in 2 different areas of the same form. It only works on an id="selectMenu" and of course I cannot have more that 1 id.

How can I get this script to work in multiple select fields? (at least more than 1)

View 4 Replies View Related

Conditional Logic In Form Fields Hide/show Email Field?

Oct 18, 2009

For some security reasons I would like to show an email field in a form ONLY if the 4 checkbox are checked.I don't want to use server side coding so I need to use javascript.I have this code, showing an alert if the 4 checkboxes are checked:

<html>
<head><script>
var conta=0;
function ctr(quale)

[code]...

It works but I nedd to ask for an email instead of showing an alert.

View 3 Replies View Related

JQuery :: Form Validation - Two Input Fields In A Form - Only One Of Two Fields Is Required

Oct 10, 2009

There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?

View 17 Replies View Related

Hide And Unhide Div Tag In IE7 And IE8?

Nov 12, 2010

The problem I am facing a that how to Hide and Unhide Div tags in IE7 and IE8? code is working in all most available Browsers.Only IE creates the problem.

View 1 Replies View Related

Getting Divs To Hide Or Unhide

May 17, 2011

I'm creating a website where I would like to create some kind of tabbed pages.To do that I wrote a javascript where I create an array of all the divs I use to create the pages and then sets them all on style="display: none;" except the one I clicked which should get style="display: block;"But I can't seem to get it to work..

View 6 Replies View Related

Resolved Auto Hide / Unhide

Jul 19, 2011

in my page i have two nav bars, one for js enabled and one for js disabled they are styled accordingly (the js disabled is display:inherit; and the js enabled is display:none;)now i may need to tweak those styles after i get the script working, but that i can toy with after i get this working anyways- my pages get the navbar inherited from a master page- so my thought was (to prevent loops) make a nav bar that had all js disabled links and a navbar that had all js enabled.

View 11 Replies View Related







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