Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applying onChange and Short Cut key in a Submit button

 
Nitin Kumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 For a submit button in a form I have two requirments
a) Apply a short cut key for the submit button ( say [Alt N] )
b) Submit the form using a JavaScript function. i.e the JS function has following piece of code
function myFun {
document.edit.submit();
}

I know two ways of implementing a submit button
i) Using input
<input type="submit" name = "save" value=" Save" >
ii) Using button
<button type="submit" accesskey="n" name="submit">Save</button>

Problem is that when I use i) , requirment a) doesn't work and when I use ii) , requirment b) doesn't work.
Is there any way out two fulfil both the requirments at the same time?

2 In a edit form there are too many text field.There is a submit button to save the changes done in the page.When this page is loaded all the text fields are prepopulated.I want that when the page is loaded , Save button should be disabled and it should get enabled only when any value is modified. One way of doing this is to write a JavaScript function to enable the button and this JS function will be called on onBlur event of EACHtext field.
Since there are large number of such pages in which modifucation need to be done , is there any other way to achieve the requirment in which I need not change ALL the text field.

These Html pages are generated using JSP.
[ June 07, 2006: Message edited by: NitinK Kumar ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can not name your btn submit, name it something else such as btnSubmit.

When you name it submit, it overwrites the submit method of the form.

Eric
 
Nitin Kumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Eric for the solution...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic