Clearing Input Fields
Jun 2, 2005
I have a form with two input fields - 'name' & 'research'. What I'd like is for 'name' to be cleared when the user clicks in 'research' & visa versa. I've tried to do this by implementing the code in Sitepoint's excellent new DHTML Utopia article, but without success. I'm guessing that I should be using the onblur event, but am not sure how to go: Code:
View 3 Replies
ADVERTISEMENT
Jun 9, 2009
how can i clear the feilds in using jquery just like reset form in html.
View 4 Replies
View Related
Sep 6, 2007
I have a page with 5 sets of form fields. Each field set has a checkbox that if checked will allow users to utilize it. I want to clear the given field set when the user un-checks the check box. As you can see in the code below this method will make for a very long and cluncky script, I would like to make it more generic.
<script>
function clear() {
window.document.roles.foo1.checked = ''
window.document.roles.foo2.checked = ''
}
</script>
<input class="checkBox" />
<input checked name="foo1" type="checkbox" class="checkBox" />
<input checked name="foo2" type="checkbox" class="checkBox" />
View 2 Replies
View Related
Jul 24, 2010
I am using jQuery AJAX to submit a form. When the data has been validated successfully and processed, I want to clear the form, but I am unsure how. I have been trying to make it work for a few hours now.
I am showing status messages in the container below:
When everything was successful, it looks like this:
And here is the simple code I use to clear the text fields:
What I need is a way to check if everything was successful and if so, then run the code above. I tried to do it in a few ways, but it kept clearing regardless of the status.
View 18 Replies
View Related
Mar 6, 2009
why isn't this working ok in ie7?:
[URL]
the javascript is:
Code:
<script type="text/javascript">
/* <![CDATA[ */
function closed_changed(day) {
[Code].....
it should call closed_changed(), which sees if it's ticked/checked, if it is it calls clear_open() and sets the four open related input elements to empty/blank (because a shop can't be open and closed at the same time). works fine in firefox (pc and mac) and safari. not ie7. why not? (the intended clear does happen but only when another subsequent closed box is ticked; it works on the previous day which was ticked; so it's lagging one behind)
View 2 Replies
View Related
Sep 24, 2010
Trying to create a method/function how ever you want to call it, that will allow me to clear input values on inputs with focus() and restore the input values if nothing is entered or keep what the user types on focusou().[code]
View 3 Replies
View Related
Mar 3, 2009
I have a list of input fields within the form and a button that can be clicked to add new input fields into the form. This works but if any of the input elements have had text entered into them, then this text is cleared when the button is selected. code...
View 5 Replies
View Related
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
Sep 7, 2009
I have a pretty basic set of things I want to do: Capture key press, compare against an allowed list, block keys that are not in that list, replace a space by a dash if entered. As this is happening, I have a span I wanted to be updated with the live values. The username field at [URL] is exactly what I am trying to do, though I have trouble dissecting how they did it. Here is my attempt, which is off by one keypress for some reason.
[Code]..
View 2 Replies
View Related
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
Jun 7, 2010
I am having a form with two input fields. I want to enter some text in the first input field and then the second field should get the same text. Is there a simple way (maybe a plugin) to do this with jQuery? It would be perfect if I even could output all these input fields values as normal text in <p> or <li> tags.
View 2 Replies
View Related
Sep 1, 2011
I'm now working on kind of invoice form which in it the user can add as much input field as he wants.
The problem is that after adding a new input field - the content in the other fields is deleted.
Code:
View 8 Replies
View Related
Jul 16, 2011
I have a problem created by my complete [rookie] status – only second time venturing into jQuery. I created a simple shopping cart using php and the PayPal buttons (1: buy now, 2: add to cart). The php back end does it great, it generates the table and the buttons and everything works just like it’s supposed to; Except, I forgot to add sizes. So I found out what I need to add, and I realize that the way the buttons work, I will have two different text boxes for size. Not very visually appealing, and since I’m not submitting this to the server before it goes to PayPal to pay, I cannot modify it with php the way I normally would. jQuery / javascript are my only hope of making this work. What I want to do:Have a single textbox where [size] is entered by the user.
Copy the value from the [correct] text box to the Value=”” section of the now hidden field in the PayPal form That way, no matter whether they [BUY NOW] or [ADD to CART] the right size is submitted to the PayPal shopping cart. This is the actual PayPal code that I’m trying to change
<table>
<tr>
<td>
<input type="hidden" name="on1" value="Size" maxlength="200">Size</td>
[code].....
I got this far, and then decided to find how to insert the "enteredVALUE" into the right place in the input text field (what I called output) and I've not been able to figure out how to stuff it in there.
View 3 Replies
View Related
Jul 20, 2010
I would like to create a form that calculates the area of a floor or wall. The user will input the length/height and width dimensions into two input fields and then click calculate.I simply need a script that multiplies the two fields together and puts the answer in a third read-only field.
View 1 Replies
View Related
Jan 15, 2010
I have a form where a user will enter in the number of input fields they need (lets call them offices) and when they click the submit button a jQuery function appends the rows to a plain html table. This works fine, except I do not want the rows to be only vertical or horizontal. I want it to put three input fields on one row before going to the next. Here is the code I have:
//This function is for adding rows to the offices table
function addOfficeRows() {
var i = 0;
[code]....
View 3 Replies
View Related
Mar 26, 2007
It's possible to declare inbut fields outside of a form, is it possible
to post these values to the server? E.g. attach them to the posted form?
View 5 Replies
View Related
Mar 16, 2010
we have form of the following code
Code:
<form name="name" method="post" action="index.html">
<input type="text" name="1" size="40" maxsize="6">
<input type="text" name="2" size="40">
</form>
I want someone give me an correct example for the following cases
for 1st one
Code:
<input type="text" name="1" size="40" maxsize="6">
1- Make it accept only numbers
2- Make it accept only numbers and only 6 digits if less then gives error
for 2nd one
Code:
<input type="text" name="2" size="40">
1- Accept only letters with no numbers
for both 1 and 2
1- Can't write HTML codes within it
View 1 Replies
View Related
Nov 26, 2009
-i have two drop down menus. -each drop down menu has its on event handler "onchange=doSomething()"
-i want to call yet another eventhandler to the same drop down menus "onchange=doMath()"
my question is, can a drop down menu perform two different events?
of should i combine these functions. i tried combining them, and i lost the purpose of both functions.
View 12 Replies
View Related
Jun 3, 2010
I've got a calculator/quotation script i've made. Once the calculation is complete, i want the user to click a button which will copy some of the field data to new fields for printing. This is fine and i can do easily, however i then want the user to be able to reset the form and do another calculation, click the same button and it copy the new data to new fields too.
So in effect you end up with all of your calculations listed somewhere for printing. how would i attempt this?
View 18 Replies
View Related
Feb 14, 2011
I am inexperienced in JavaScript. I have an html page with several numeric input fields which are an array. At the bottom of the screen is a running total of the numbers entered.
The html is like:
<INPUT TYPE=TEXT NAME='array[0]' onchange='addup()'>
<INPUT TYPE=TEXT NAME='array[1]' onchange='addup()'>
[code]....
View 2 Replies
View Related
Jun 18, 2011
I have just started learning JavaScript, so I do not know much about it at this moment. I need suggestion regarding validation of input values which are actually in an array. My HTML looks like this:
Link# 1: <input name="url[]" size="80" type="text">
Title# 1:<input name="title[]" size="80" type="text">
Link# 2: <input name="url[]" size="80" type="text">
Title# 2:<input name="title[]" size="80" type="text">
Link# 3: <input name="url[]" size="80" type="text">
Title# 3:<input name="title[]" size="80" type="text">
.
.
.
.
.
And so on. (up to 20)
User can add more input fields by adding "Add" button; I'm using JavaScript for that purpose. By default, only a couple of fields is shown. I want to validate these all fields using a loop or a number of loops, such that an alert appears if any field is left blank and also if any value in title[] array matches another value in that array and same for the second array url[] Examples of working would be something like this:
If Link# 1 is left blank: alert("Link# 1 is empty");
or
If Link# 2 is left blank: alert("Link# 2 is empty");
or
If Title# 1 is left blank: alert("Title# 1 is empty");
or
If Title# 2 is left blank: alert("Title# 2 is empty");
or
If Link# 1 == Link# 2: alert("Link# 1 is same as Link#2");
or
If Link# 1 == Link# 3: alert("Link# 1 is same as Link#2");
or
If Title# 1 == Title# 3: alert("Title# 1 is same as Title#3"); etc, etc.
View 14 Replies
View Related
Jan 7, 2007
I am having a very hard time figuring out how to dynamically disable certain fields in a form based upon the user's answer to a <select> element.
So, first I have a <select> element to my form asking the user to choose one of three choices, like so:
<SELECT Name="mortgagetype">
<option value='First'>First</option>
<option value='Second'>Second</option>
<option value='Third'>Third</option>
</SELECT>
The next 6 fields are all input fields:
<INPUT Type="text" size="30" Name="Question1">
<INPUT Type="text" size="30" Name="Question2">
<INPUT Type="text" size="30" Name="Question3">
<INPUT Type="text" size="30" Name="Question4">
<INPUT Type="text" size="30" Name="Question5">
<INPUT Type="text" size="30" Name="Question6">
The tricky part is that I want the availability of certain fields to depend on the user's answer to the <select> element that comes first. If they answer "First" then questions 1, 2, 3 and 4 should be disabled. If they answer "Second" then questions 3 and 4 should be disabled and if they answer "Third" none of the questions should be disabled.
View 2 Replies
View Related
Aug 6, 2010
i'm having difficulties with jQuery datepicker to get two input fields with different dateformats, her is my code sofar:
<script type="text/javascript">
$(function() {
$('#inlineDatepicker').datepick({
[code]....
View 1 Replies
View Related
Sep 2, 2011
I have 2 input fields.
Input 1: Website URL
Input 2: Website Directory
Firstly I would like the "http://" to automatically appear in input one and two and it can't be edited or removed. Then whatever is typed in input one, I would like it to automatically copy into input 2, and the user can't delete whats in input 2 without going through input 1. Then lastly the user can add data into input 2, without input 1 changing.
Here is an example:
Red = Can't be deleted Green = Can be changed Blue = additional text to input 2
Input 1: http://www.yourwebsite.com/
Input 2: http://www.yourwebsite.com/extra/directory
How to do this?
View 4 Replies
View Related
Feb 20, 2010
how to clear all input fields after submitting data?
[Code].....
i always find everyday on how can i clear the input fields after submitting on it.
View 9 Replies
View Related
Oct 10, 2011
How would I use cluetip to display a tip besides the input field when the focus is on that field? I haven't seen any examples or demos on how to do that. Does that work or do I have to use some other tool?
View 1 Replies
View Related