Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Call backend function from javascript?

Posted on 2006-04-16
3
Medium Priority
?
1,760 Views
Last Modified: 2012-06-21
Hi, when a user presses enter on this button I want it to trigger "saveitem_Click". I understand that this is the normal behavior, but I have a table onkeydown function redirecting enters in to tabs document wide, so I need to reenable that for just this field.

Here is the button:

<td onkeydown = "javascript:press_save()" style="height: 14px;">
                    <asp:Button ID="saveitem" runat="server" TabIndex="23" Text="Save" Width="46px" OnClick="saveitem_Click"


Here is the javascript function. Both commands I tried give an error.

 function press_save()
        {
                document.forms[0].saveitem.onclick();
                saveitem.click();
                 
        }


Thanks!


Terry
0
Comment
Question by:TerryBurger
2 Comments
 
LVL 6

Accepted Solution

by:
nabsol earned 1500 total points
ID: 16465763
Hi

Is your button in a form.

document.forms[0].saveitem.onclick();
or
document.forms[0].saveitem.click();

should work.

By Nab
0
 
LVL 15

Expert Comment

by:deepaknet
ID: 16467375
You can use AJAX to do this.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

810 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