Use A Checkbox To Disable A Function?

Jan 29, 2011

Actually, the subject pretty much is the question, but if you want more detail, here goes code...

pans and zooms the map when the user selects a line, which is really useful about 95% of the time and kind of annoying 5% of the time. So I was thinking it would be good to give them the option of disabling that function for the 5%.

the function gets called from a couple of different places in the code, so for neatness' sakes it would be nice to have something within the function above that checks for the checkbox state before executing. but some kind of if/else where the function gets called would be ok, too..

View 2 Replies


ADVERTISEMENT

Use Script To Disable Checkbox?

Mar 14, 2009

Say there are two checkboxes on a page (test1 and test2), I want to write a JavaScript code that disables one if the other is checked. Here's what I wrote that didn't work code...

View 6 Replies View Related

Quick Form / Checkbox Disable

Jul 6, 2006

I've got the following code being used to make a checkbox selected and readonly when a radio button value is selected:

document.myForm.valueName.checked = true;
document.myForm.valueName.disabled = true;

However when submitting the form values in email, the value of the checkbox won't submit with the checkbox value being disabled (if I comment out that second line, it works). Of course, I don't want the value able to be unselected.

Any suggestions? Can I make it readonly instead?

View 1 Replies View Related

Checkbox To Enable/disable Form

Feb 25, 2004

I have a checkbox at the top of the page, and then I have a form full of text fields etc, called 'frmEnquiry'.

I would like the form to be disabled (or the text fields, elements etc) when the checkbox is not enabled, and when ticked i would like it to be enabled.

Is there a function or way round this?

View 1 Replies View Related

Disable Checkbox Unless One Check Is Checked

Dec 23, 2009

Code JavaScript:
<script language=javascript>
function apply()
{
document.frm.sub.disabled=true;

[Code].....

Im using the above code. if, change this code for array of checks box not working. If i change above html code like below , Then how to change javascript?

Code HTML4Strict:
<form name="frm">
<input type="checkbox" name="chk[]" onclick="apply()" />
<input type="checkbox" name="chk[]" onclick="apply()" />

[Code]....

View 1 Replies View Related

Select Box Options To Disable/enable Checkbox?

Jan 18, 2006

I need to be able to uncheck and disable a checkbox based on the option selected in a Select list.

This is what I tried.

==============
<script type="text/javascript">
function GetOptVal(OptVal)
var OptVal;
{
if(OptVal="XX") document.form1.chkbox1.disabled = false;
}
else
{
document.form1.chkbox1.checked = false;
document.form1.chkbox1.disabled = true;
}
</script>
<form name="form1">
<select name="Opt1"
onchange=GetOptVal(document.form1.Opt1[document.form1.Opt1.selectedIndex].value)>
<option value=" ">Select One</option>
<option value="XX">XX</option>
<option value="YY">YY</option>
<option value="ZZ">ZZ</option>
</select>
<input type="checkbox" name="chkbox1" />
</form>

View 2 Replies View Related

Disable Text Fields When Checkbox Is Checked

Sep 15, 2006

I want to disable three textareas when one checkbox is ticked. how would i go about doing this?

My code:

View 7 Replies View Related

Checkbox Disable Field Browser Back

Oct 19, 2006

I have a form with some text fields that are disabled UNLESS a checkbox is checked. Initially the text fields are disabled and the checkbox is unchecked.

The code is something like this:

Code:
function disableTextbox() {
if (chk.checked) {
txt.disabled = false;
} else {
txt.disabled = true;
}
}

<form action=something.cfm>
<input type=checkbox name=chk onclick=disableTextbox();>
<input type=text name=txt disabled>
<input type=submit>
</form>
When the form is submitted, some validation is performed. If anything fails, I display an error message and show a link to go back (history.back).

The problem that I am having is that when you click on the link to go back, the checkbox on the form is checked, but the text fields are disabled.

You have to re-click the checkbox to update the text field.

View 3 Replies View Related

Disable All The Other Checkbox Based On The Selection Of First Check Box

Dec 11, 2007

disable all the other checkbox based on the selection of first check box

View 3 Replies View Related

JQuery :: Disable Download Button Unless At Least 1 Checkbox Is Selected?

Jun 30, 2010

I have an accordion pane with each pane containing checkboxes and a button. How do I disable the buttons on all the accordion panes until the users checks at least one checkbox?

View 3 Replies View Related

JQuery :: Enable/disable Button Base On Checkbox?

Jul 1, 2010

I have a table there are checkbox in all rows, then I have a button in disabled.

I hope the button will be enabled if one of checkbox is checked, button should be disabled if no any checkbox is checked, what can I do?

View 1 Replies View Related

JQuery :: Uncheck And Disable Multiple Checkboxes With One Checkbox?

Apr 7, 2011

I have the following checkboxes:

[ ] None [ ] Option 1 [ ] Option 2 [ ] Option 3

When the first checkbox is checked (None), I need the other three checkboxes to:

1. Become unchecked if the user had checked them

2. Become disabled

If/when the first checkbox is unchecked after that, the other three checkboxes would become enabled.

View 4 Replies View Related

Enable / Disable Form Fields When Checkbox Is Checked?

Dec 6, 2010

I have multiple forms on my website. Some of them have a checkbox which is checked by default, whereas others are unchecked by default. I'm trying to figure out how I would detect whether or not the checkbox is checked, and if it is checked, disable certain fields (not necessarily all fields), and then toggle it back and forth as I check or uncheck the box..I found this code:

Code:
<script language="javascript">
<!--

[code]....

View 4 Replies View Related

Select Any Checkbox, Enable Disable Button And Add Class

Jan 30, 2011

Firebug returns an error saying msg.elements is undefined. I'm trying to make a function that will enabled a delete button if any of the check boxes in a list are checked.

Code:

function selectone () {
var msg = document.getElementsByName('pm');
var i = 0;
for(i; i < msg.elements.length; i++)

[Code]....

View 2 Replies View Related

Enable/disable A Textbox On That Row If Checkbox Is Checked/unchecked?

Dec 23, 2010

I have a gridview with a checkbox (CheckBoxActiveClient) in the first column and a textbox (Copies) in the 5th column. I want that row's textbox (Copies ) to be disabled if the checkbox is unchecked in that row.
I wrote a javascript function for this but it doesn't work.

Code:
<script type="text/javascript">
function EnableTextBox()

[code]....

View 8 Replies View Related

Disable Function Key F1?

May 3, 2005

I USE THIS CODE TO DISABLE FUNCTION KEY, ITS WORK PRETTY EXCEPT F1. [code]...

View 12 Replies View Related

Disable A Function When Ctrl Or Cmd Is Pressed?

May 28, 2011

I want to disable a function when a user is pressing control or command using Javascript. Is this at all possible? My reason for doing this is because I recently implemented lightbox to my script, but I still want users to be able to open the image in a new tab by just clicking control or command when clicking the image rather than opening it in lightbox (which it does).

View 1 Replies View Related

Pass A Checkbox Value To Function

May 11, 2010

I am trying to figure out how to pass the value of an item from my HTML form through Javascript/Ajax.

Here is the code:

This is what I have in my showRSS function:

This does not seem to be working, is there something I have missed here to that the value in my checkbox input would be passed through the showRSS function?

View 8 Replies View Related

Using The Function To Dynamically Enable/disable Controls?

Mar 24, 2010

Call the function below in body onload event to disable all controls of the page during loading.

function disablePage()
{
var controlType;

[code]....

View 1 Replies View Related

Checkbox Array - Which One Called The Function

Dec 10, 2010

I've tried Googling this, but haven't found anything, yet.If I have an array of checkboxes, and each checkbox calls the same function with onClick, is there a way to indicate to the function which checkbox within the array called the function?

Code:

<input type="checkbox" name="thisCheck" onClick="myFunction();" value="ALL" />
<input type="checkbox" name="thisCheck" onClick="myFunction();" value="abc" />
<input type="checkbox" name="thisCheck" onClick="myFunction();" value="def" />
<input type="checkbox" name="thisCheck" onClick="myFunction();" value="ghi" />

View 9 Replies View Related

How To Disable (View Source) And (Copy Function) From Site

Aug 4, 2008

Is there a chance to disable these two things from my site?
(View Source) and (Ctrl + C)

View 9 Replies View Related

JQuery :: Add A Function To An Event Click From A Checkbox?

Dec 9, 2011

I'm trying to add a function to an event click from a checkbox. But the function is executed on the page load, not when i click on a checkbox...

Here is my code :

var tabTailles = {
"38092":{"id":38092,"qte":8,"produitsIds":[293649,293653,293655,293656]},
"38093":{"id":38093,"qte":20,"produitsIds":[293649,293653,293655,293656]}
}

[code]....

tabTailles is an array but not a js array. val is an object.

View 4 Replies View Related

Function On Checkbox That Pops Up Alert Menu?

Oct 23, 2009

How would I go about making a function on a checkbox that pops up one alert menu when its checked and pops a different alert when its unchecked? Here's what I have so far I know its wrong I don't know how to change the beginning.

Code:
function compare(bing){
if ("bing"=checked){
alert("You agree, your favorite search engine is also bing.");
}else{
alert("you disagree, your favorite search engine is not bing.");
}}

View 11 Replies View Related

JQuery :: Disable Click Function For Area With Specific ID Attribute

Nov 22, 2010

I have an image map with various areas on it. A user can click on the various areas and something happens. That said, I sometimes need to disable the ability to click on some areas. For instance areas whose id attribute contains 0 0. I have the code to split the id and grab whether the values are 0 or 1 and the alert pops up when one has 0 0 in the id but it's still clickable. I thought .unbind would do the trick, but it isn't. The alert is simply for testing.

$('area').each(function(){
// Use the each() method to gain access to each elements id
var idToDisable = $(this).attr("id");//get id of area
var splitID = idToDisable.split("_");
if (splitID[3] == 0 && splitID[5] == 0){
alert(splitID[3]+splitID[5]);
$(this).unbind('click');
}else{
}});

View 3 Replies View Related

JQuery :: Disable A Hover Function And Make The Attributes Permanent?

May 30, 2011

see there is a featured section with 3 images on the homepage ... there's a left image, center image and right image ... when you hover your mouse over the left or right picture, an arrow and a white overlay shows up so you're able to switch the images ... i'd like to take away the hover and instead make that arrow and white overlay permanent. This means that once the website is loaded, the arrow and white overlay is already there without having to hover the mouse pointer over the image ... here are the specific codes that controls the animation ....

jQuery('.next-block a').live('click',function(event){
event.preventDefault();
if (!et_animation_running) rotate_slide('next');

[code]....

View 3 Replies View Related

Return A True Or False Value From A Function To Disable Automatic Postback?

Sep 14, 2011

Im creating a task loggin system and this allows the user to raise tasks and update them, im using javascript for validation and if the fields are empty it then changes the fields back ground to Red which is fine but then it goes on to update the data in SQL which i dont want, any suggestions or how i can achieve no post back is the result from the function is False (for fields in error)Html Code where im calling the function

<asp:button runat="server" id="btnChangeCommentsAuth" CSSclass="RaiseButton" OnClientClick="CommentsCheck('MainDisplayContentChange_txtAuthCommentsArea');" PostBackUrl="~/RaiseTaskChange.aspx" Text="Auth" />

[code]....

View 6 Replies View Related







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