Originally posted by JerryBrightbill
View Post
The problem is not your english - it is fine. The problem is that there isn't a good solution.
When you are working with browsers, html, and JavaScript, many actions are defined by common web standards. These standards result in behavior that may not fit every situation. Because they are standards that allow almost all browsers to work the same, they can't be changed and you have to work around them. This is just one example.
Strictly speaking, there is no action in html to capture the "Enter" button action. Most browsers are "helpful" and highlight the first submit button in a form element when focus is placed on an object in the form. This is done to allow an "enter" button push to "push" a button. Since the Delete button is shown before the submit button, it has focus. This can not be changed.
The best way to change this is to change the order of the buttons and place the submit button first. There is currently no method in the components to change the order of the buttons.
However, there are a few solutions currently available to you. The easiest is to add a "Confirm before delete" action to the detail view properties. If the user accidentally "presses" the delete action, a confirmation message will pop up that should get their attention.
The second method is more complex. You can change the html generated by the component after it has been created on the page. Html is just text. Therefore any character replacement functions will work. The trick is to find the text for the buttons, and "reverse" them. This is done by modifying the code using the source tab view for the page. Here is an example for a component name "grd_cust". The first 2 lines would already exist in the code when viewed on the source tab. The code below the line is added.
The text in "button1" matches the text in the generated html of the detail section for the "save" button.
The text in "button2" matches the text in the generated html of the detail section for the "delete" button
The text to replace will be found in the "DetailView_HTML" output from the component
The first replacement changes the code for the "Save" button to the code for the "Delete" button. At this point, there will be 2 delete buttons
The second replacement changes the code for only the first "delete" button to the code for the the "save" button.
The Save button is now before the delete and will have focus.
This same character replacement concept can be used to replace any gereated html with other html.
When you are working with browsers, html, and JavaScript, many actions are defined by common web standards. These standards result in behavior that may not fit every situation. Because they are standards that allow almost all browsers to work the same, they can't be changed and you have to work around them. This is just one example.
Strictly speaking, there is no action in html to capture the "Enter" button action. Most browsers are "helpful" and highlight the first submit button in a form element when focus is placed on an object in the form. This is done to allow an "enter" button push to "push" a button. Since the Delete button is shown before the submit button, it has focus. This can not be changed.
The best way to change this is to change the order of the buttons and place the submit button first. There is currently no method in the components to change the order of the buttons.
However, there are a few solutions currently available to you. The easiest is to add a "Confirm before delete" action to the detail view properties. If the user accidentally "presses" the delete action, a confirmation message will pop up that should get their attention.
The second method is more complex. You can change the html generated by the component after it has been created on the page. Html is just text. Therefore any character replacement functions will work. The trick is to find the text for the buttons, and "reverse" them. This is done by modifying the code using the source tab view for the page. Here is an example for a component name "grd_cust". The first 2 lines would already exist in the code when viewed on the source tab. The code below the line is added.
HTML Code:
x_grd_cust = a5w_run_Component(tmpl_grd_cust) '============================================================================================================= button1 = "value=\"Save\" name=\"grd_cust_DetailView_Save\"" button2 = "value=\"Delete\" name=\"grd_cust_DetailView_Delete\"" x_grd_cust.Output.Body.DetailView_HTML = stritran(x_grd_cust.Output.Body.DetailView_HTML,button1,button2) x_grd_cust.Output.Body.DetailView_HTML = stritran(x_grd_cust.Output.Body.DetailView_HTML,button2,button1,1,1)
The text in "button2" matches the text in the generated html of the detail section for the "delete" button
The text to replace will be found in the "DetailView_HTML" output from the component
The first replacement changes the code for the "Save" button to the code for the "Delete" button. At this point, there will be 2 delete buttons
The second replacement changes the code for only the first "delete" button to the code for the the "save" button.
The Save button is now before the delete and will have focus.
This same character replacement concept can be used to replace any gereated html with other html.
i do not want to focus on submit or cancel.
any consideration of making it easier, instead of altering the java codes.
thanks
ken tjia
Leave a comment: