how to add up a series of text boxes which contain numbers that a user will input and have the total of those text boxes show up in a quantity text box on the next page.
Not sure if i should use javascript or php, but i don't know how to do it either
I'm primarily a database programmer (Mysql and PHP) but I have some Javascript programming and I have been programming in other languages for over 25 years.
On to my problem:
I'm trying the create a function in Javascript which will take a variable from three different text boxes and show the net result in a fourth text box that is ReadOnly. This is all on the same page. All three text boxes have other Javascript scripts formatting the value in the text boxes.
I'm trying to have a user input a number in a prompt box which gets totaled and displayed in an alert box.This is what I have and its not working out for me.
I'm absolutely terrible at coding javascript, it makes no since to me, I'm "ok" at html but I just can't get Java, but anyways. I'm working on an averaging code for a forum I apart of that has to take the selected number from 5 drop down boxes adding them together, dividing by 5 and displaying the result.
the code I have is barely half completed, but it's not to long just the same thing over and over with the drop down boxes, so I was hoping someone could help me with this. Or at least guide me in the right direction. Code:
I'm trying to create a form where the user enters data in a field and is redirected to a URL based on that entry - example: user enters 1234 and he is directed to mypage.com/1234/index.htm - if that folder does not exist it would give a 'try again' error.
In a registration form middleName field is optional. When the users enters his/her middleName, then it should validate that field. I have used the following code to achieve the above scenario, but it is not working.
$("#middleName").rules("add", {checkName: true, required: false, messages: {checkName: "Please enter a valid middle name"} }); jQuery.validator.addMethod("checkName", function(value, element) { var regExp = new RegExp(/^[a-zA-Z0-9s|,|.|-|']+$/); return regExp.test(value); }, "Please enter a valid name." ); How to achieve the above scenario.
I need to make sure the zip code the user enters matches up with 1 of 50 acceptable zip codes - so if they enter nothing at all or enter a zip code that does not match up with one of the 50 acceptable zip codes they get an error. I know I need some kind of conditional statement like: if (#zipcode != "12345 || 23456 || 45678 || 12365") .. do something...
I have an ASP page that displays, along with other data, a list of items that refer to a specific element in a database. Instead of adding an Add button, I would like to display a text box below the last item in the list to have the user input any new data. Once they enter the data and hit Enter, the data they enter should then be added to the list and another text box added beneath this item (just as forms and tables in Access do). However, I'm not sure how to implement this functionality.
I am trying to setup a donation form for a friend, where someone can click radio buttons for set donation amounts, or click the "other" radio buttons and enter a different amount. The donation amount is then passed over to a secure credit card entry page, hosted by a 3rd party merchant.I can set up all the pre-defined radio buttons to correctly pass on the donation amount to the credit card page, but I cannot figure out how to work the "other" radio button amount.
I am trying to setup a donation form for a friend, where someone can click radio buttons for set donation amounts, or click the "other" radio buttons and enter a different amount. The donation amount is then passed over to a secure credit card entry page, hosted by a 3rd party merchant.
I can set up all the pre-defined radio buttons to correctly pass on the donation amount to the credit card page, but I cannot figure out how to work the "other" radio button amount.
I am trying to create a web page in which the contents of one selection list depends upon which element in another selection list is chosen, but where the information to populate the first selection list comves from an SQL database on the web server.
There are a couple of these situations in my application but, for example, the first list might be a list of counties, and the second list a list of states/provinces. Obviously the names of counties depend upon which state/province is chosen, but there are too many possibilities to be able to embed them within the web page itself. So when the user selects a state/province I need to go to the server to ask for the list of counties.
I have seen a number of posts that sort of address this issue. For example it is suggested to use <script src="a URL"/> to ask the server side code to send up data of type "text/javascript". However the examples do not seem to address how the server side code would know which state/province the user had selected.
If there is a web site that addresses this sort of thing, I would appreciate any pointers.
I am trying to allow the user to type in two numbers and then a multiplication table pops up below it. how to make the first row be 0,1,2,3,4,5..ect and same for the first column in each row going down the table. Here is my code..
I have a textbox on one of my forms that is used to accept a time from the user. I need to write this value to a database to trigger an event later on.
What I'd like to know is...
Are there any functions in javascript that can convert different time formats to a known format (24 hour clock)... 5pm -> 17:00 or 5:00 to 05:00, etc. ???
Assuming that I get the input into a 24 hour format, how can I create a full time/date variable with todays date and the users entered time?
Finally, if the entered time is earlier than the current time, how can I create the above date/time combination using tomorrows date?
I'm trying to create a 4 x 4 array filled with numbers input by the user. I then need to rotate the grid clockwise like I've shown below.
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
13 09 05 01 14 10 06 02 15 11 07 03 16 12 08 04
I made all numbers double digit just for show in the example so the table is easier to read. So far the code I have is just trying to create the array and fill with numbers from the user. This asks for a number once then doesn't display anything at all.
I have been presented with: Draw a flowchart and write a javascript program which will accept two numbers from a user and will determine whether the second number is a factor of the first. This is determined by dividing the first number by the second and checking if the remainder is 0. This is made easier if you find out what the operator does. The output should be in the form 4 is not a factor of 6 and 3 is a factor of 6. I have tried a few attemps and yet still not sure what the problem is :confused:
I have two input boxes on a form which receive the first and last name of a user. I want to be able to use charAt() to get the first letter in each box and pass it a third box on the same form. is this doable? May I request some help? I was thinking something like the function below would be the starting point --I stand correct, as it is not working.
<script type="text/javascript"> var str="Mossa"; <!--document.write(str.charAt(0));--> document.write('<INPUT TYPE=text size=2 VALUE="str.charAt(0);">'); var str="Barandao";
I have a textbox in a form, and I need to allow users to enter dates in US Format (MM/DD/YYYY). But they do not want to type any slashes, just 8 numbers, and have the slashes added for them.
My work website, [URL] has an activity search on the top-right side of the page that searches congregation details. It mostly works fine, except that if you search "greenwood" instead of getting shown Greenwood Uniting Church, it tells you that there are no congregations within 15km of Greenwood. Yet if you search "Kingsley" (Next suburb over, less than 15km from Greenwood) it finds the Greenwood Uniting Church.
We worked out that the issue is that there is more than one Greenwood in Australia, so it needs to be clarified that the state of WA needs to be added to the search. The easiest way (I feel) is to check whether WA has been included in the text, and if not, to add it to the search text. This is the code I've got so far (written by a friend, who wasn't certain whether it would work or not):
PHP Code: echo '<script type="text/javascript">'; // Check that there's state appended to the search echo 'function checkState(){'; echo 'var searchField=document.getElementById("suburb-address");'; echo 'if (searchField.value.lastindexOf("WA")==0) { '; echo 'searchField.value+=", WA";'; echo '}'; echo '}'; echo '</script>';
(It's included in a Wordpress Plugin, hence the echo tags)and the form itself: PHP Code: echo '<form method="post" action="http://'.$current_site->domain . $current_site->path.'home/activity-search" onSubmit="javascript:checkState();return true;">'; echo '<label>Suburb:</label><input type="text" name="address" id="suburb-address" title="Enter Suburb & State" />'; echo '<select name="categories[]" >'; echo '<option value ="">All Activities</option>'; $categories_list = split('[ ]', get_setting('categories', $db)); foreach ($categories_list AS $cat){ $cat = trim($cat); echo '<option>'.$cat.'</option>'; } echo '</select>'; echo '<label>Country:</label>'; echo '<select name="country" id="country">'; echo'<option>au</option>'; echo '</select>'; echo '<label>Radius:</label>'; echo '<select name="radius" id="radius">'; echo'<option>15</option>'; echo '</select>'; echo '<input type="submit" name="submit" value="Search" class="btn" />'; echo '</form>'; I'm wondering whether the if statement is valid, but I'm not knowledgeable in Javascript, so I don't know where to begin.
I wish to have my form update a text field when a 'add' link or button is clicked, allow for more entries to be added without having the page refresh. but i need to be able to have both the friends name and their number added to the field like so
if friends name is say 'jason' and their number is '0987654321' then it will add to the textarea like so.
jason [0987654321] this way i should be able to get the data and split it up when the form is send so i can add them in the DB. the part i am stuck on is how to get both fields in the textarea. allowing for more to be added without a refresh. can anyone suggest how they might do this.
I have a drop down box (select) in my website: [URL] that works fine; but the problems is if the user click on a wrong option, it will show a box and if the user click on another option from the box, the last one will be on display and won't go off..
Like this select something and then at the same box change the selection you will see the code will build up boxes on the screen.. How I do for it not happens if the user change the option in the last box, the one before disappears!