Solved

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

Posted on 2004-04-28
8
223 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
  • 2
  • 2
  • 2
  • +1
8 Comments
 

Expert Comment

by:l0_0laelien
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 10

Expert Comment

by:eeBlueShadow
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 4

Expert Comment

by:Neil_Simpson
Comment Utility
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
Comment Utility
If you need further help with this I'll be happy to provide it.
0
 
LVL 3

Author Comment

by:Meps
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now