473,416 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Call cancel button from ajax(JS)

250 100+
I'm using ajax in my php site. In there I have two buttons named as submit and cancel. When I click submit button it validates data using ajax. (No need to use form for this). But the following code is not working for cancel button
Expand|Select|Wrap|Line Numbers
  1. function Cancel(){
  2. cancel = document.getElementById('test').value.reset();
  3. }
If I put form,
Expand|Select|Wrap|Line Numbers
  1. (<form name"test.php">)
cancel button is working but errors return from the submit button are gone. Could someone pls help me ?
Jun 30 '09 #1
1 2352
Dormilich
8,658 Expert Mod 8TB
@ghjk
first, there is no native reset() method to the String object (doing a reset I'd rather define element.value = "";)

second, sumbit/reset buttons are supposed to be used in forms (mind that you can have multiple forms and a submit/reset button works only on the form, where it is defined). you should rather use the normal click buttons if you don't have a <form> element*.


* - semantically it doesn't make sense to have a submit button without the corresponding form (i.e. without something to submit)
Jun 30 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: uNConVeNtiOnAL | last post by:
Hi - I can't call my js until the page is loaded down to the </body> tag - is there something similar to body onload that I can use to automatically run the script just before the page is done...
9
by: Fred Weinhaus | last post by:
Can anyone point me to some good online literature about communicating between PHP and AJAX. Are there any libraries that would allow PHP to send back request information to the calling HTML page?...
8
by: Midgard | last post by:
Hi, I have this ajax script ajax.js var http_request = false; function update(formid,divid){ document.getElementById(divid).innerHTML="Please wait ..." var form =...
25
by: meltedown | last post by:
This is supposed ot be an example: http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/ It says : This example is probably the simplest example you will ever...
10
by: trpost | last post by:
I am using ajax / php where I am looking up some info from the database and populating a select list dynamically, however I am running into some sort of size limitation with the ajax.response...
1
by: bsprogs | last post by:
I am currnetly programming a file hosting website in PHP and I am slowly integrating AJAX into the website. Here is my problem: The user uploads the file. The server processes the file and...
1
by: wenijah | last post by:
Hi everyone! First thank you for reading this post and yes, you probably already see that kind of topic title somewhere but the problem I've got today might be different than the 100 topics I've...
8
by: ManWithNoName | last post by:
I hate to bug you guys with more of my problems but IE is trying to make me climb my walls for the past several hours... I thought I just explain the problem and if it sounds familiar I could get...
0
by: Manikrag | last post by:
Hi Team, Is there any way to call a .js file. I can call a function as.. btnSave.Attributes.Add("onLoad","alert('hello');"); but not sure how to call a .js file here. Thanks!
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.