Using Multiple Return Values ?
Jun 10, 2009
I was looking at some public code for detecting browser version/type as well as the new IE8 compatibility view. The code does a return of multiple values but I can't figure out how to use them in my html code.
I've managed to figure out most of what the code is doing but I haven't figured out how to access the returned information. I've only been coding JavaScript for a short time so I'm stumped.
Here's the code:
CODE:
View 4 Replies
ADVERTISEMENT
Jul 19, 2011
I have a list of products where they have minimum quantities in a hidden input. Some products have multiple colours, though the same minimum quantity and I'm trying to implement a jQuery check that entries made are at least equal to the minimum.
Blank or '0' entries are fine but if it's below the minimum quantity it should set to the minimum.
HTML:
Is there something obviously wrong with this? It isn't performing the minimum check and I'm really not sure why.
View 1 Replies
View Related
Jul 11, 2006
Can javascript using pointer or pass variable by reference?
Or I need to using object or Array to return the two values?
View 2 Replies
View Related
Dec 8, 2011
I am trying to build an interface to upload files and change some of the form (hidden) values depending on the file uploaded, here is where I got so far:
$('#buttonUpload').click(function (){
$.ajaxFileUpload({
url:'doajaxfileupload.php',
secureuri:false,
fileElementId:'fileToUpload',
dataType: 'txt',
[Code]....
My problem is that I want doajaxfileupload.php to return a variable to javascript/change some html form value. The code works as it is for the file upload, I just need to add something for the output, Edit: I just noticed that some previous part of the code is still there: the part that changes the color of the button depending if the file is uploaded or not. Now I want those values to change depending on what file is uploaded.
View 1 Replies
View Related
Jun 29, 2011
Ok so i'm going to try and be as descriptive as possible for this issue is extremely challenging for me to resolve.
I am creating an auto suggest search feature and I decided to do it in OOP.
My current set up is like this..code...
View 5 Replies
View Related
Sep 8, 2011
I have a understanding problem with this:
var loadData = function(){
$.post('/search.php', { myvar: 12345 }, function(data){
$.each(data, function(key, val) {
// here I have to validate my data I retrieved
if(first condition){
return false;
[Code]...
View 7 Replies
View Related
Jan 19, 2006
I have a bunch of input fields, each which will have a numerical value. There can be any number of input fields in the form, and that number will vary depending on what the user has selected prior in the application.
So basically I created a loop that goes though all of the INPUT fields within the form. How can I have it find the value of each field and add them all together, then return to me the total? It'll need to be made into a variable, but a simple alert with the total value will give me enough to work with.
View 2 Replies
View Related
Jan 30, 2006
i am finding value for a table height in window.onload=function(){
boxheight=document.getElementById('tableid').offsetHeight;
}
i want to assign box height to an outside variable boxheight. Code:
View 1 Replies
View Related
Jan 8, 2012
I have a problem with attr() function.I made my own lightbox and with jQuery 1.4.x it works nice. But now I use 1.7 and there is a problem. When I called attr in 1.4 $(element).attr("rel") when element hasn't rel, it returns empty string, but in 1.7 it returns undefined.Why? I read a changelog and I didn't find any change at that function.
View 2 Replies
View Related
Mar 19, 2009
I am setting up a text search with 3 search buttons to allow 3 different searches from the one text box. Each search has different values for the 2 hidden elements. So far I've got the 3 submit buttons working with the below code but I can't figure how to get the hidden values to be inserted. For each of the 3 different submits I need to tell javascript what the 2 hidden values are.
<SCRIPT language="JavaScript">
function OnSubmitForm()
{
if(document.pressed == 'questions')
{
[Code]....
View 4 Replies
View Related
Apr 4, 2009
I have a table with a bunch of inputs. The user can enter data for the inputs in each row, as well as add a row, move a row, delete a row. The names for the inputs in each column are column1[], column2[], etc. I use PHP to receive the form, and the inputs are automatically converted into arrays. Every thing works great until now....
I want to add a new column with a simple yes/no input.
<input type="checkbox" name="newcolumn[]" /> doesn't work because if the checkbox is not checked, it doesn't return anything and my array for this column no longer correlates with the arrays for the other columns.
<input type="radio" name="newcolumn[]" value="0" /><input type="radio" name="newcolumn[]" value="1" /> doesn't work because each row uses the same name.
Giving each row a unique name will be very difficult given how I add/remove/move rows.
My "simple" input turned out not to be very simple. how I can return a zero or one from each row of inputs?
I am thinking of using JS to upon submit, check another checkbox input (with value=0) adjacent to the first one (with value=1) for each row if the first one isn't checked.
I am also thinking of adding hidden input to each row, and giving the user some sort of button on each row which uses JS to set the hidden input to 1 or 0.
View 4 Replies
View Related
Aug 12, 2009
This has me completely stumped. I have a multiple select form element in my HTML document that needs to be manipulated by two different sets of context-sensitive controls. One set of controls is marked up as follows:
<div id="divControls1" name="divControls1" style="display:none">
<form id="fControls1" name="fControls1">
<input type="button" id="btnAdd" name="btnAdd" value="Add" onClick="addStuff();" />
<input type="button" id="btnEdit" name="btnEdit" value="Edit" onClick="editStuff();" disabled />
<input type="button" id="btnDelete" name="btnDelete" value="Delete" onClick="deleteStuff();" disabled />
</form>
</div>
When I load this page into Safari (on Mac OS X) and set the style of divControls1 to "display:block," I have an enabled "Add" button, a disabled "Edit" button, and a disabled "Delete" button, just as I expected. (I monitor selections in a multiple selection element to turn the buttons on and off.) But when I load this page into Firefox (also Mac OS X), all three buttons are disabled at startup. My page runs a function called startup() when the body fires onLoad. To try to troubleshoot the problem, I wrote this line at the beginning of the startup() function:
function startup() {
alert (document.getElementById("btnAdd").disabled);
...
When I run this code in Safari, the alert returns "false" (not disabled), just as I would expect, and intended. However, the same code in Firefox (Mac OS X) returns "true" (disabled) ... but the same code in Firefox (WinXP) returns "false"!
View 1 Replies
View Related
Jul 20, 2005
I am trying to retrieve selected values from a multiple select object on a page:
*** Selection Page ***
<form name="theForm">
<select name="numbers" MULITPLE>
<option value="1">One</option>
<option value="2">Two</option>
<option value="2">Three</option>
</select>
</form>
What I want to do is to pass the selected values from "Selection page" to its parent window. Right now, I pass the values by doing this (in JavaScript):
window.opener.parentForm.num.value = document.theForm.numbers.value;
I'm assuming if mulitple selections are made (lets say One and Two are selected), document.theForm.numbers.value will be a collection of the selected option values. Is this correct?
If so, how can I retrieve each option value when coding parent window?
View 1 Replies
View Related
Nov 2, 2010
I am trying to do some JavaScript calculation with checkboxes, and have been able to modify some codes to do bits of what i want to do. (Screenshot attached) However, i want each checkbox to have multiple values, and therefore multiple results.
I can't find any examples, but i've come across something similar with Radio buttons [URL].. I don't 'get' the example enough to proceed. My question is, is it even possible to do with a checkbox, and if so how do i go about doing it please?
The Javascript code:
function count() {
var item1price = 10;
var item2price = 50;
var item3price = 1100;
var item4price = 100;
[Code]...
View 3 Replies
View Related
Apr 23, 2010
I'm trying to figure out how I can pass multiple values to my javascript from one selectbox. code...
As you can see the product_id get passed to the javascript, but it is essential that I get the price and color id passed along... Is that possible, and if yes.how?
View 5 Replies
View Related
Nov 2, 2010
I am trying out checkbox total calculator code examples, which automatically calculates the values of checked/unchecked items, and so far so good. My question is if it's at all possible for each checkbox to have multiple values, so i can have different sets of totals? I have been looking for examples all over with no luck. I have seen examples for Radio buttons, which separates the different totals with commas, but i don't have enough JavaScript experience to understand it fully.
View 11 Replies
View Related
Apr 17, 2007
I have a table which I have made work where I put some values in and the script works out the result on an onChange event.
My question is that I want to make the table rows populate from a database so each of the javascript values will have to be unique for the value to be worked out on a specific row calculation.
The code as it is works out the single value but how would i go about using the mechanics of the code to apply to multiple lines in the table. Code:
View 2 Replies
View Related
Apr 23, 2009
I have a drop down box in a form like this...
<select name="product[]" id="unitcost">
<option value="92">92mm</option>
<option value="130">130mm</option>
</select>
The value selected is passed to a shopping cart. However, I also need to pass a unit price which is different depending on the value selected.
View 2 Replies
View Related
May 11, 2009
<pre><code><font size="4"><span>
Is there a way to find multiple values?This script checks <u>name = ben</u>, what about I want to check if <u>name = ben</u> and <u>name = joe</u>?
var</span><span> items </span><span>=</span><span> </span><span>[{</span><span>id</span><span>:</span><span>1</span><span>,</span><span> name</span><span>:</span><span>'bob'</span><span>},</span><span> </span><span>{</span><span>id</span><span>:</span><span>2</span><span>,
[code]....
View 1 Replies
View Related
Jun 14, 2009
In a string (that contain the Flash version installed), I want to replace:
all "," by "."
"win" by <nothing>
all spaces by <nothing>
So far I do it this way:
strFlashVer = strFlashVer.replace(/,/g, '.');
strFlashVer = strFlashVer.replace('win', '');
strFlashVer = strFlashVer.replace(/ /g, '');
but I'm sure theres better way (I'm not really good with reg exp).
View 3 Replies
View Related
Jul 26, 2009
I am having trouble getting values from multiple radio sets. I know it is probably elementary, but this is the code I am using:
Radio Set 1
<label>
<input type="radio" name="radSafe1" value="AR" id="radSafe1" onClick="SetFocus('1_1')"/> </label> <label>
[Code].....
Well, I am using the alert function to test the values, but no matter what is checked, even if none are, the values for both of them are always "AR".
View 5 Replies
View Related
Dec 2, 2010
I'm having problems getting the values of selected checkboxes and outputting them to a textarea. This seems like quite a simple thing to do but its causing me a lot of bother! I am using a mixture of JavaScript and jQuery to find a solution to this.
<h2>Booking Form</h2>
<form name="booking">
Please choose the days that would suit your visit: <br/>
<input type="checkbox" name="days" value="Monday">Monday<br/>
<input type="checkbox" name="days" value="Tuesday">Tuesday<br/>
<input type="checkbox" name="days" value="Wednesday">Wednesday<br/>
[Code]...
View 10 Replies
View Related
Sep 9, 2011
I have to check for several possible values of a variable and I currently do it like so:
(SHIP_TYPE == "M" || SHIP_TYPE == "S" || SHIP_TYPE == "X")
But this seems overly manual to me. I'm imagining something like the SQL "IN" function:
SHIP_TYPE IN ('M','S','X')
Does such a thing exist in JavaScript, or do I need to write my own function?
View 9 Replies
View Related
Nov 24, 2011
I am setting up an email form & i would like the subject field to hold multiple values, the forrm will be something like this:
Name:Mr A
Date: 01/01/01
Reason:Football
I want the form to send an email without opening an email client & I would like the subject field to look like this: Subject: Mr A, 01/01/01, Football Subject Mr A - 01/01/01 - Football
Can anyone tell me if this is possible, if if is can you please point me in the right direction.
View 1 Replies
View Related
Jun 11, 2009
Is
fibonacciArray = [20];
fibonacciArray[0,1] = (1,1);
Possible?
I know I can do:
fibonacciArray = [20];
fibonacciArray[0] = 1
fibonacciArray[1] = 1
But the former requires less typing
View 3 Replies
View Related
Nov 12, 2009
Maybe this has been tackled in another post but I couldn't find it through some searching so here goes...I'm using an Ajaxy method to update an administrative form and what I would like to do is update multiple text fields when the onchange fires from a dropdown list. Basically, I pull up a business name in the dropdown and fields for address, city, postal, phone, fax, etc... is updated.
The script that I've cobbled together is really good at updating one item via the XMLHttpRequest() responseText property and I could send a string of variables that I could break out into an array to loop into the innerHTML of each item but I was hoping there would be a more sophisticated way to do it.Is there a way to pass a responseArray instead of just a string of text?
View 2 Replies
View Related