Clear the form inputs after submit

Posted by nitharshan on 09-Apr-2015 00:26

Hi all,

I am developing a rollbase mobile Application, It has a page with radio button, check boxes and some input fields. there i need to clear the entire input values and refresh the radio buttons after submit the form. Any idea?

Thank you

Nitharshan

All Replies

Posted by egarcia on 09-Apr-2015 05:42

Hello Nitharshan,

The code generated by the Mobile App Builder does not include an actual HTML form element because Ajax based applications do not submit a form as in old style web applications.

To clear input fields you would need to walk through the input elements of the container, for example, mobileContainer1 and update the value of the element directly.

Alternatively, you can update each field individually.

You can use jQuery to simplify the access to the elements.

For example, the following code would clear the value of an input field:

   $("[dsid=mobiletextinput_1]").val("");

Here is a link that I found via DuckDuckGo with code that approximates what you are looking for:

   www.sitepoint.com/jquery-function-clear-form-data

You can call the clearForm() function using the following:

   clearForm( $("[dsid=mobileContainer1]") );

I noticed that it works fine to clear the input fields, however, it did not seem to work for radio-set and check-boxes. It would need some debugging.

Please use that code as a starting point and post back if you need more information.

I hope this helps.

This thread is closed