Solved

Can Java or something run a query when a button is clicked?

Posted on 2004-04-28
8
231 Views
Last Modified: 2012-06-21
What I am trying to do is when a radio button is checked, and everytime it is checked to run a specific query.

Like:
APPROVED -> runs update ..... set approv='APPROVED'
DENY  -> runs update ..... set approv='DENY'

The radio buttons will be dynamic, meaning the amount of approved, and deny buttons will be based on a cfquery.  I really don't want the page to refreash on each click either.  Is this possible?  Thanks
0
Comment
Question by:Meps
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 

Expert Comment

by:l0_0laelien
ID: 10940931
hi Meps,
do you want to run the query when u click the submit button?, one diferent query for each radio, right?.. And are u using JSP and Java ?
0
 
LVL 3

Author Comment

by:Meps
ID: 10941070
That is the thing, there will be no submit button, only the radios.  One for Approve, and one for deny.  Right now I am not using either JSP, or Java.  But I figured that HTML, or CFML will not be able to preform this feature without java or the other.

Example of form:
A      D        Apples
A      D        Cookies
A      D        Locks


And you will just click on either the approved radio, or the deny radio, and go down the list, until either the list is done, or you have to leave.
0
 

Expert Comment

by:l0_0laelien
ID: 10941532
i think u need to send the value of the checked radio (via URL) by Javascript on the onclick method of the radio, then catch that value and send it to your query.. in JSP i'll do something like :

updateQuery(request.getParameter("nameOfChecked"));
 
that's an idea.. :|
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 10

Expert Comment

by:eeBlueShadow
ID: 10944772
Quite simply, the answer is no.

Javascript runs entirely on the users machine, and the code you will need to update the database or run a particular query must be stored on the server. The only way to exchange information between the two in a web browser is to submit information and retrieve another page in return.

What you could try and do is make the page quick loading so that the delay between different clicks is smaller. Or, you could look into developing a Java applet or Flash movie which can sit in the web page and keeps a connection to the sever open, letting you do real time updates.

Both of those options would need advanced coding skills though, so the refresh-every-click choice is probably your best option.

_Blue
0
 
LVL 4

Expert Comment

by:Neil_Simpson
ID: 10951677
Depending upon the data you need to transfer you could load it all into the HTML on the first page laod and then use Javascript and CSS to just display the relevant info when the radio button is checked. This avoids the page reload problem but relies on you being able to load all of the data initially so it really depends on your query/data.
0
 
LVL 4

Expert Comment

by:Neil_Simpson
ID: 10951684
If you need further help with this I'll be happy to provide it.
0
 
LVL 3

Author Comment

by:Meps
ID: 10976628
I was thinking about useing a query to display the items someone will need to approve, and inside the output have the radio buttons display, so if I have one item, there will only be one set of radio, if I have 50 items, there will be 50 sets.  So I know what is going to be on the page, and was curious if there was someway to do live updates when the buttons are clicked.

_Blue, what you say make sense.
0
 
LVL 10

Accepted Solution

by:
eeBlueShadow earned 250 total points
ID: 10976770
Well, consider the following:

In most cases, submitting any information to a server gets you another page which replaces the original. However, one time that doesn't happen is when the new page is loaded in a new window/frame/iframe - you still get the old page where it was before.

It is perfectly possible to have lots of forms on one page.

It is possible to have a form submit on an onclick event.

try the following HTML which submits the form on each mouse click, and loads the form in a *hidden* iframe so you never see the response. Note that the request is still sent to the server but there is no way to tell if there was an error.

Hopefully you can see how it all works and could be written into whatever loop you have to make the radio buttons

<!-- START CODE -->
<iframe name='t' style='display:none'>
</iframe><br>
<script>
function goForm(id)
{
    form = document.forms[id];
    form.submit();
    for(var i = 0; i < form.elements.length; i++)
    {
      form.elements[i].disabled=true;
    }
}
</script>
<form name='item1' target='t' action='show.php'>
<input type='radio' name='item1' value='approve' onclick='goForm("item1");'><br>
<input type='radio' name='item1' value='deny' onclick='goForm("item1");'><br>
</form>
<form name='item2' target='t' action='show.php'>
<input type='radio' name='item2' value='approve' onclick='goForm("item2");'><br>
<input type='radio' name='item2' value='deny' onclick='goForm("item2");'><br>
</form>
<!-- END CODE -->

_Blue
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question