342
Views
10
Comments
Solved
how can I trigger the onchange again? (when clear the input autocomplete)
Question

Hello Community!

I did this input with autocomplete, but I have some problem because whenever I clear the contents of the input, the on-change event of the input is not triggered and allows behavior that I don´t wish according to my business rules.  How can I do to run the Onchange again and fix this behavior? 

Because isn´t supposed to allow creating a loan without student selected. 

I attached the oml. 

Best regards, 

Jessica Marques. 

SistemadeBiblioteca.oml
2021-03-18 21-03-15
Benjith Sam
 
MVP
Solution

Hi Jessica,

Replace the first IF node of the SaveRequest screen action with the below condition

Trim(Student_Search) = ""
or
StudentId = NullIdentifier()

Hope this helps you!


Regards,

Benjith Sam

2020-09-15 09-38-17
Jessica Marques

Benjith Sam wrote:

Hi Jessica,

Replace the first IF node of the SaveRequest screen action with the below condition

Trim(Student_Search) = ""
or
StudentId = NullIdentifier()

Hope this helps you!


Regards,

Benjith Sam

 thanks for the help, now it works!

I know that the function Trim is for removes space characters, but I didn´t really understand how it works for this case... Can you explain to me?

 Regards, 

Jessica Marques. 

2016-04-22 00-29-45
Nuno Reis
 
MVP

Hello Jessica.

There are probably overlapping functions on the javascript OnChange (check here the same issue) because of AutoComplete and your definition of On Change.

Like Benjith said, you must do an extra validation before saving. Imagine the user edited the field value by playing with debug. Your event can't detect that so the invalid information would pass.

2020-09-15 09-38-17
Jessica Marques

Nuno Reis wrote:

Hello Jessica.

There are probably overlapping functions on the javascript OnChange (check here the same issue) because of AutoComplete and your definition of On Change.

Like Benjith said, you must do an extra validation before saving. Imagine the user edited the field value by playing with debug. Your event can't detect that so the invalid information would pass.

 Hi,

thanks for the indication, I had read this post but I couldn't find an alternative to help me. 

Regards, 

Jessica. 

2018-06-05 16-54-03
Maria da Graça Peixoto

Hi! 

Another solution can be , not use the 

OnSearchStudentChange

action and  use the 

Input_AutoComplete_GetIdentifier

in the 

SaveRequest

action , as I did in the application attached.


Hope this helps. 

Regards

Graça

SistemadeBibliotecaversaoGraa.oap
2020-09-15 09-38-17
Jessica Marques

Maria da Graça Peixoto wrote:

Hi! 

Another solution can be , not use the 

OnSearchStudentChange

action and  use the 

Input_AutoComplete_GetIdentifier

in the 

SaveRequest

action , as I did in the application attached.


Hope this helps. 

Regards

Graça

 Hi Graça, 

Thank you for this idea. 

I did as you said with "student",  and with  "book" too.


Best Regards, 

Jessica Marques. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.