Page 1 of 1

How to show top of screen on Validation Failed?

Posted: Thu May 15, 2014 3:59 am
by Tooba Atif

I have a contact form that has some mandatory fields and I have use JS validation to check the mandatory fields. Now if the validation failed the error should appears in red on the top of the screen but currently on submit the screen is not scrolled to the top and shows the same position of screen.
How can I show the top of the screen on validation failed?

My js is something like this
if(code === '')
{
Appery("lblRequiredFields").text('Please enter numeric data.');
return;
}


How to show top of screen on Validation Failed?

Posted: Thu May 15, 2014 4:29 am
by Yurii Orishchuk

Hi Tooba.

You should execute code to get app scroll top.

So please try to modificate your code with code below:

precode

if(code === '')
{
Appery("lblRequiredFields").text('Please enter numeric data.');
jQuery("body")[0].scrollTop = 0;
return;
};

/code/pre

Regards.


How to show top of screen on Validation Failed?

Posted: Thu May 15, 2014 4:35 am
by Tooba Atif

Worked perfect!
Thanks a lot :)

Can you help me with this please?
https://getsatisfaction.com/apperyio/...

I am still unable to load complete screen on page load. It has to wait for the option selected 1st then according to response from service it shows the next grid on the screen.


How to show top of screen on Validation Failed?

Posted: Thu May 15, 2014 7:42 am
by Maryna Brodina

Hello Tooba!

Please add an update to this post https://getsatisfaction.com/apperyio/... and let's continue there.