473,404 Members | 2,187 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,404 software developers and data experts.

Updating from a list without reloading the page

FP
I'm displaying a list of messages.
Each message can be checkmarked as done or not done.
When a user clicks on the checkmark I want the following to happen;
- checkbox status is toggled between checked & unchecked
- database record is updated
- HTML page is NOT reloaded

Can I do the following in javascript?
- have clicking the checkbox run a javascript function
- js function opens a new window, passes record ID as a hidden field
in a form
- new window has PHP code to do update record
- new window has js code that closes it again
- checkbox is toggled

If this is not possible, can someone suggest a different way to
accomplish the same task?

Jul 11 '06 #1
2 1970
Can I do the following in javascript?
- have clicking the checkbox run a javascript function
- js function opens a new window, passes record ID as a hidden field
Yes. Why even bother with a form? You could just invoke an url:
'registerCheckbox?chechbox=checkbox1&value=true'. Anyway, you can use a
hidden IFRAME on your page to process data, there is no need to open a
window, though if you want you can do so with window.open(..). A
checkbox has an onclick handler, you can use that:

<input type="checkbox" name="checkbox1" onclick="checkCheckbox(this);"/>

function checkCheckbox(checkbox) {
if (checkbox.checked) {
//.. do this
} else {
// do that...
}
document.getElementById('form').submit();
}

You can target a FORM to a window/frame:
<FORM ID="form" TARGET="checkboxProcessFrame" METHOD="POST">
... fields ...
</FORM>

Now use the NAME field of a IFRAME, FRAME or window as a target.

Hope the hints help,
Vincent
Jul 11 '06 #2
"FP" <ad@pottnerconsulting.cawrote in news:1152625312.639252.120000@
75g2000cwc.googlegroups.com:
Can I do the following in javascript?
- have clicking the checkbox run a javascript function
- js function opens a new window, passes record ID as a hidden field
in a form
- new window has PHP code to do update record
- new window has js code that closes it again
- checkbox is toggled
Ajax: "...exchanging small amounts of data with the server behind the
scenes, so that the entire web page does not have to be reloaded each
time the user makes a change."

http://en.wikipedia.org/wiki/AJAX
Jul 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Urs Vogel | last post by:
Hi I would like to update certain controls based on the user's entered data (e.g. entering a cutomer id would display the name and address). This wouldn' be a problem, but I would like to do...
9
by: paul | last post by:
Hi All, We have a small dilemma. We have the following page: http://giggsey.com/m00Cow.php (don't ask about the content) that we want to turn into an interactive application for some new intake...
2
by: jwriteclub | last post by:
I have a question regarding back button functionality in an "ajaxy" web application. Here is the scenario: The user navigates to a page http://domain.com/app/. Since app/index.php file...
10
by: chadsspameateremail | last post by:
I first should list my background and that is that I'm new to PHP. I would like to be able to have an HTML form where there is a list that you choose from. Depending on what item is chosen in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.