cancel
Showing results for 
Search instead for 
Did you mean: 

avoid refreshing screen values

Former Member
0 Kudos
38

Hi all,

I have developed a screen with some input fields and there are some validations based on values entered in those input fields. For Example there is a field Category which is a dropdown and there is a field Comments which is text field, and there is a field Account which is a input help field. Now when I select a particular category from dropdown and enter some comments without selecting account, an error would be triggered using javascript alert. Now my issue is when an error message is triggered all the comments gets refreshed and even the category gets cleared off. How shall I avoid clearing of the fields, any pointers on this?

Thanks and Regards,

Sneha.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sneha,

Please post your javascript code, so that we can try and suggest you something...

Maybe, you are Submitting the form after the alert..!!

Hope this helps.

<b><i>Do reward each useful answer..!</i></b>

Thanks,

Tatvagna.

Former Member
0 Kudos

Hi Tatvagna,

The Code runs as follows,

There is a OK button on the screen. When user enters some values and press OK,

OnInputProcessing:

When 'OK'.
if category is 'ABC'.
if account is initial.
MESSAGE-TEXT = 'Pls enter Account'.
endif.
endif.
ENDCASE.

In Layout:

<script>
alert("<%= message-text%>");
</script>

And if i try to validate using OnClientClick attribute there is an issue with clearing checkbox value.(The check should get cleared here)

var category = document.form.CATEGORY.value;
var account = document.form.account.value;
var customer = document.form.customer.checked;

if (category == "ABC" && account == "")
{
document.form.customer.checked = false;
alert("Pls enter Account.");
}

Any suggestions/Pointers on any of these solutions would be appreciated.

Thanks and Regards,

Sneha.

athavanraja
Active Contributor
0 Kudos

for some reason setting htmlb:check box state (checked or unchecked) using javascript is not working.

in your case to retain the values of other fields , you should read them and set to variable used in that element.

for example if you have a inputfield

<htmlb: inputField id = "ip"

value = "<%= comment %>"

then in oninputprocessing you should do the following

data: ip type ref to cl_htmlb_inputfield .

ip ?= cl_htmlb_manager=>get_data( request = request

name = 'inputField'

id = 'ip' ).

if not ip is initial .

comment = ip->value .

endif .

Former Member
0 Kudos

Thanks Raja,

My Problem is solved.

Regards,

Sneha.

Answers (0)