473,322 Members | 1,501 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,322 software developers and data experts.

making button enabled based on div innerhtml set by ajax funtion

Hi,
I have a javascript function that uses ajax to set a div based on a query.
The javascript function is invoked on a button click and uses ajax like this:
Expand|Select|Wrap|Line Numbers
  1. function validDate(node,roomid)
  2. {
  3. var allparams= 'timechk=' + params +'&starttime=' +params1 +'&endtime=' + params2 +'&roomid=' + params3 +'&ckres=' + params4
  4. var ajax = new Ajax.Updater(
  5. {success:ck_res},
  6. url,
  7. {method: 'get', parameters:allparams, onFailure: reportError});
  8. }
  9.  
  10. }
  11.  
ck_res is the div whose innerhtml should be set

this is the ajax function that sets the div

Expand|Select|Wrap|Line Numbers
  1. <cfif NOT IsDefined("url.timechk")>
  2. <div >Please enter a valid date.</div><cfabort>
  3. </cfif>
  4. <cfquery datasource="#application.datasource#" name="datelookup">
  5. SELECT  ---------
  6. </cfquery>
  7. <cfif datelookup.recordcount>
  8. <div ><cfoutput>This date is booked.</cfoutput></div>
  9.  
  10. <cfelse>
  11. <div >This date is free.</div>
  12.  
  13. </cfif>
  14.  
I have a save button on my form.And i want it disabled until the div is set as "This date is free".How do I do that?
Mar 18 '08 #1
3 1701
acoder
16,027 Expert Mod 8TB
The Ajax Updater will have an onSuccess event. In that, call a function that checks the contents of the div for "This date is free". If found, set the Save button's disabled property to false.
Mar 18 '08 #2
The Ajax Updater will have an onSuccess event. In that, call a function that checks the contents of the div for "This date is free". If found, set the Save button's disabled property to false.
thanks again :) ............................
Mar 18 '08 #3
acoder
16,027 Expert Mod 8TB
You're welcome :)
Mar 18 '08 #4

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

Similar topics

12
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ----------------------------------------------------------------------------...
5
by: C Watson | last post by:
Hi, I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very specific feature that I would like to use it for. I have a rather long form that the users use to enter data...
4
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the...
1
by: planetthoughtful | last post by:
Hi All, I have a web page that presents records in a table, with one row per record. I'd like to put an edit button next to each record, such that if a user clicks on the edit button next to...
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 =...
8
by: Pratik Patel | last post by:
Hello, I used innerHTML to assign HTML content. but in my HTML page content have also some javascript function and it will run when page load. bu when HTML code assgin thru innerHTML then this...
5
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio...
3
by: Sunny | last post by:
Hi, Can someone tell me, How to load the Body Html from a text file that contains javascript. to Manage my files I am creating an Index Page. <html> <head> <meta http-equiv="content-type"...
19
Frinavale
by: Frinavale | last post by:
I'm in the middle of implementing a custom Ajax enabled Server Control. At this point I need help finding the answer to an Ajax Framework question...here it goes: I have a Server Control that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.