Submit Adding Back In Checkboxes That Were Unchecked In Javascript
Jul 23, 2005
The following script is supposed to have high categories as radio buttons and mid categories as check boxes. Clicking the radio button is supposed to select all checkboxes under it and submit the form.
RADIO (ID = 0001-1 VALUE="")
CHECK (ID=0001-0011)
CHECK (ID=0001-0012)
RADIO (ID = 0001-2 VALUE="")
CHECK (ID=0001-0021)
CHECK (ID=0001-0022)
The code appears to be checking and unchecking the correct checkboxes. But when the submit occurs, the buttons that were unchecked become checked again.
function handleHighCatSelect(obj)
{
var highCatName = obj.name;
var highCatNameInMidCat = highCatName.substring(0,5) + "00" +
highCatName.substring(5,6);
alert(highCatName);
var length = document.frm.elements.length;
for (var i=0;i<length;i++)
{
var formObj = document.basicSearchMFSFrm.elements[i];
var currName = formObj.name;
var currValue = formObj.value;
if ((formObj.type == 'radio' || formObj.type == 'checkbox')
&& (currName.indexOf(��-') != -1) )
{
if ((currName.indexOf(highCatNameInMidCat) != -1) ||
(currName == highCatName ) )
{
formObj.checked = true;
}
else
{
formObj.checked = false;
}
}
}
frm.submit();
}
View 2 Replies
ADVERTISEMENT
Aug 26, 2009
I have a function which is executed whenever someone clicks a checkbox on the page. There are lots of checkboxes on the page. I want the function to be performed on only the unchecked boxes. I've tried this two ways, neither of which has worked. Here are the two methods I've tried.
Method #1
$(".item input:unchecked").each(
function() {
if ($(this).val() > diff) {
[Code]....
Where diff is an integer and the values of the checkboxes are all integers. The problem is the function ends up getting run on all checkboxes, even boxes that have been checked.
View 3 Replies
View Related
Jan 25, 2011
I have a for and lets say 4 checkboxes. I want to get the values of the checkboxes that are checked & to get the values of the checkboxes that are not checked. So if someone check the A & C checkbox I will get that A&C has this value (because they are checked!) and B,&D has this value(because they are not checked). Example this is my table....
<table >
<tr>
<td><label><input type="checkbox">A</label></td>
<td><label><input type="checkbox">B</label></td>
<td><label><input type="checkbox">C</label></td>
<td><label><input type="checkbox">D</label></td>
</tr>
</table>
View 2 Replies
View Related
Jul 23, 2005
I am having a problem in my struts application with the checkboxes in
my form. I have an array of checkboxes, some of which may be already
selected when the form loads. My problem is when the user then
deselects one or more of these checkboxes and submits the form -
they're being submitted as if they were still checked, when the user
has infact deselected them.
I've heard that this is a common problem, but I don't seem to be able
to find the problem / resolution with any search criteria. If anybody
knows the fix for this it would be greatly appreciated (if there is a
solution without using Javascript I would prefer this as we're trying
to write the application so it's not too dependant on Javascript . . .
View 4 Replies
View Related
Mar 14, 2010
I'm currently designing a website for a takeaway company, and have one page displaying their menu. So that customers can easily calculate how much their takeaway will cost, I'm going to put checkboxes next to each item.Each of the checkboxes' value will be the price of the item, and I need a script that will add the values (prices) of the checkboxes they've ticked.They can then see the total cost of their takeaway without having to work it out, and add or remove items accordingly. I will then add a button which will print out a list of the items they ticked with the total price at the bottom. The customer can bring this in with them and the staff can easily see what they want and how much to charge them.
Firstly, I need to know how to make Javascript add these values (and probably save them as a variable) Secondly, how would I make this display on the page (either after they click a button, or automatically so they can see the price real-time)? - I assume this would be basic coding --- document.write(var) And finally, how could I make a script which would print only the items which are ticked, and the total price?
View 4 Replies
View Related
Aug 24, 2009
I'm using jqtransform and here's the function for the checkboxes. What code would I use the select/deselect all?
$.fn.jqTransCheckBox = function(){
return this.each(function(){
if($(this).hasClass('jqTransformHidden')) {return;}
[Code]...
View 16 Replies
View Related
Jan 31, 2011
What I am looking to do is have 4 different check boxes, one for each different site. For Example:
checkbox1 (if checked would popup) www.site1.com
checkbox2 (if checked would popup) www.site2.com
etc.
When the user clicks the submit button each site that is check marked would popup in a different window.
View 6 Replies
View Related
Aug 22, 2006
is there a way i can add history to the back button? so say they are on the same page but the layout of the page keeps changing but the actual page isnt changing. i want to add something in the history so that if they hit the back button it doesnt take them to the actual last page but the perceived last page.
View 3 Replies
View Related
Apr 11, 2009
I have an image gallery and wish to add previous and next buttons to work alongside the numbered links
here is the page with the javascript and html.
------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<head>
[Code]....
View 9 Replies
View Related
Nov 16, 2010
Am just starting a new site and this morning noticed my header background image (logo) was missing.
Started out with normal CSS/HTML navigation menu.
www.westernwebdesign.com.au/pelican/index.html
Then I added a Vista buttons navigation menu:
http://www.westernwebdesign.com.au/p...cal/index.html
and the logo was gone. Not exactly sure at what point it disappeared yesterday as I didn't notice it missing until this morning. The navigation is about the only point of difference so I think this is the issue but have no idea why.
View 3 Replies
View Related
Nov 24, 2009
I am working on improvements for a web app. It currently submits checkboxes to a php script for processing by simply submitting the form naturally. However I require this action using a ajax post to save bandwidth etc. and im struggling to work out how to do this. I am familiar with normal ajax posts using jquery but here I need to post an array.
Simplified a little this is what I have.
<input type="checkbox" name="ckdOrd[]" value="1" id="order_1" />
<input type="checkbox" name="ckdOrd[]" value="2" id="order_2" />
<input type="checkbox" name="ckdOrd[]" value="3" id="order_3" />
<input type="checkbox" name="ckdOrd[]" value="4" id="order_4" />
It used to build an array ckdOrd[] and post to a php script with a loop for processing. It needs to post the order numbers as an array for processing. Is there a way to simply create the same post using ajax jQuery?
The PHP simply does something like this
//get posted array
$ckdOrd=$_REQUEST['ckdOrd'];
foreach
$ckdOrd as $key => $ord_no {
//update mysql here
}
View 2 Replies
View Related
Jun 11, 2010
I'm trying to add a back and forward button to some scrolling images. The code that handels this runs on load and will cycle the images.
Code:
function rotater() {
if(document.layers) {
document.placeholderlayer.document.write(items[current]);
document.placeholderlayer.document.close();
[code]....
View 1 Replies
View Related
Jun 30, 2009
i have a form being filled. i don't want the user to be able to submit twice. how can i either prevent the user from going back or disable the submit button?
i am currently disabling the submit button but when the user clicks back(from the next page) it asks whether it should resend data. when the data is resent it loads the original version of the page(without submit disabled).
View 9 Replies
View Related
Jan 15, 2010
How can I make this code disable the submit button once it has been pressed, then if the user hits back or GOES back, it will re-enable it again?
<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
function formControl(submitted)
{
[code]....
View 2 Replies
View Related
Jul 23, 2005
So, here's my problem :
I've created a table in my document, presenting a list of items, one
can 'select' by clicking on it... (Kinda like a menu, you make your
choice from) But since this table can get very long, I've put
something of a 'search-form' on top, which enables the user to make a
selection of products from the list.
Now, the form uses a "post" method, and submits to itself, using the
form action. Some PHP script will make sure that the form is filled
out already, the next time it's presented.
The table, containing a list of products is presented, below the form.
When a user clicks on a product, the product should be "selected". At
first i just used a <a href="zoeken.php?prod_id=24"> link to do this,
but the problem is that my form won't remain in tact.
So now, the global idea is to submit the form after setting a hidden
form-field using JavaScript, using a onClick event.
Here's my code :
View 6 Replies
View Related
Feb 3, 2010
when the following code is used in my JSP page:
$('#myForm').bind('submit', function() {
$('#submit').attr('disabled', 'disabled');
});
it disables the submit button when my form is submitted (IDs are used). This action displays a result page. If the browser's Back button is pressed to change some of entered items, the submit button in Firefox is still disabled, while the same action in MSIE8 enables it again. I don't know if this is exactly JavaScript/browser/chache issue, how to get the submit button enabled 'automatically' Unfortunately the refresh button in Firefox doesn't help either (probably JSP issue) - I have to press Enter on the address bar which is not very obvious for every user.
View 1 Replies
View Related
Feb 22, 2009
Let me start out by saying that this is for a small-time page with absolutely zero valuable information. PHP or server-side is way beyond the scope of my goals for the project.
Basically, I have a form on a page which I want to use to submit a password. However, I have realized that using the form submit always makes the browser return to the page with the form.
Well, that's not good when I want to redirect using javascript!
My javascript is:
Code:
My form HTML is:
Code:
How can I get this to stop going back to the page with the form after I submit it?
View 3 Replies
View Related
Jan 15, 2006
In my HTML, I have several of the following:
<input type='checkbox' name='right[]' id='right[]' value=Ɔ' />
All are the same except the value is set differently for each one. The
reason for the [] is so I can access the checkbox values as an array on
the processing page (when clicking 'Submit');
However, I want my Javascript code to examine these objects first. My
onclick event handler function (below) is called (I get the 'hi there'
popup), but it does nothing afterward (i.e., neither 'checkbox' alert
appears, and the handler, strangely, seems to return 'true').
I suppose my problem is that I am not specifying the checkbox array
properly. I tried several variations, but I've been working on this
problem alone for several hours and am getting nowhere. Code:
View 9 Replies
View Related
Jan 18, 2005
I use the following code on a form (which works)
function SubmitDocument(){
var frm=document.forms[0];
if(frm.QuestionSeventeen.value=="") {
alert("Please enter your postcode");
window.document.forms[0].QuestionSeventeen.focus();
return false;
}
else
document.forms[0].submit();
}
This is fine, because QuestionSeventeen is a text field. However, I have a number of radio and checkbox values on my form which I need to make sure are not NULL.
I want to make this more efficient and not use LOTS of these nested IFs.
i.e., does anyone have any code that will check firstly specified text fields, then radio buttons, then checkboxes in a more efficient manner?
so.... somthing like this process is what I want to achieve
Function validate()
- make array of text fields, loop through them checking not null THEN
- make array of checkbox fields, loop through them checking not null THEN
- make array of radio button fields, loop through them checking not null THEN
If all OK, save doc otherwise alert that field needs to be filled in then gocus on that field END FUNCTION
View 15 Replies
View Related
Mar 15, 2006
I want to know, is there any other methods other than history.forward(), to disable back operation in HTML using javascript.
View 1 Replies
View Related
Jan 11, 2007
I'm attempting to use the javascript 'history.go(-1);' to make a page automatically return to the last page a user visited. At the moment, I can get this to work ONLY if I insert a link into the page.
What I want to happen is, the page autmatically sends the user back to the previous page after a set time. I have this for my JS:
function backtomusic() {
window.location = history.go(-1);
}
And in the body section of my page I have:
<body onLoad="setTimeout('backtomusic()', 3000)">
When it runs I get an error saying 'undefined' in the browser address bar
Any ideas?
View 1 Replies
View Related
May 28, 2006
I am doing a javascript back button within my form
<input type=submit value="Back to previous page" class=header onClick="history.go(-1)">
for some reason it is submitting the form instead of going back a page --
why would this be?
View 3 Replies
View Related
May 11, 2004
I have a form in which I disable the backspace key from going back a page if typed.
It works in IE I can disable the backspace key from going back but not in mozilla. Does anyone know why this does not work in mozilla?
<body onkeydown="if (event.keyCode==8) {event.keyCode=0; return event.keyCode }">
View 20 Replies
View Related
Apr 15, 2005
Does anyone know of a javascript that will allow a visitor to go back two pages? I've tried this but it will just go back one page.
<input type="button" name="back" id="back" onclick="history.back(-2);" value="Go back" />
View 1 Replies
View Related
Jul 23, 2005
Can someone show me how I can have:
<a href="javascript:history.back()" name="Back" value="Back"
style=width:40px;float:right;margin-left:0px class="button" >Back</a>
but since this href exists in a frame, it only pertains to this frame?
View 4 Replies
View Related
Oct 3, 2007
I have a page where users can filter a list of links using javascript clicks. The user then clicks a link in that list, views the page and then clicks back on the browser to view the rest of the list but the javascript options they filtered in the list are gone resulting in them having to do it all over again. Is there a solution to this?
Would it work if I store their selections in a cookie each time they click a javascript button and then when they visit a link and click back (to what is presumably now a cached page) will I be able to have javascript that will read the cookie and reset their options again or is the cookie not loaded on a cached page?
Are there any common solutions to this kind of thing?
View 4 Replies
View Related