This topic is locked

Clear Form Data on Add Record

10/2/2019 11:05:21 AM
PHPRunner General questions
B
bcritchley author

When I click save on my add record page, I am redirected back to the add page again, but the form data is still held and if a user refreshes the screen they can submit duplicate record info if they do not pay attention to the browser warning?

Is there a way to clear the form data after the record add and before they are presented with anew form.

Sergey Kornilov admin 10/2/2019

By default Add page fields are cleared after the record is added. Do you use any code in events like BeforeAdd? If you remove return true; from BeforeAdd event record won't be added and data in the form will be preserved.

B
bcritchley author 10/2/2019



By default Add page fields are cleared after the record is added. Do you use any code in events like BeforeAdd? If you remove return true; from BeforeAdd event record won't be added and data in the form will be preserved.



I have the following added to the JavaScript on Load event to set the tab order.

$("input[id^='value_Requestor_Name']").attr('tabindex', 1);

$("input[id^='value_Requestor_Email']").attr('tabindex', 2);

$("input[id^='value_Requestor_Phone']").attr('tabindex', 3);

$("select[id^='value_Pickup_Location']").attr('tabindex', 4);

$("select[id^='value_Destination_Location']").attr('tabindex', 5);

$("input[id^='value_Earliest_Pickup_Date']").attr('tabindex', 6);

$("input[id^='value_Latest_Pickup_Date']").attr('tabindex', 7);

$("input[id^='value_Item_Weight']").attr('tabindex', 8);

$("input[id^='value_Item_Size']").attr('tabindex', 9);

$("textarea[id^='value_Details']").attr('tabindex', 10);
// Place event code here.

// Use "Add Action" button to add code snippets.

Sergey Kornilov admin 10/2/2019

This code alone should not be causing this kind of behavior.