By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

Updating from a list without reloading the page

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.