SugarApplication::redirect keep $_POST data

Hi All

OK, so i basically use a before save logic hook to tell my users what not to do i.e.

SugarApplication::appendErrorMessage('check in date has to be before check out date');

after that I make a

SugarApplication::redirect('index.php?' . http_build_query($params).'&return_module=Leads&return_action=DetailView&offset=1');

This works perfectly. The issue is that I have many many many fields which need to be filled out, some have a check, some don’t, hence if any field is wrongly filled out, all the date (correct or incorrect is refreshed after the redirect.

How can I keep the data in tact, so that the poor user doesn’t have to re-enter everything ?

Please help

You can use Verify the filled in data before submitting the form. For this you can prevent the form submit event. And if validation is fine then you can submit the form simply. Otherwise you can show the error message via Jquery/Javascript without refreshing the page.


Hi and thanks for the reply

can you give me an example of “error message via Jquery/Javascript without refreshing the page” ?

I have tried the alert(), but it doesn’t seeme to work in a hook !

Any help much appreciated