Page 1 of 2

How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 7:51 am
by abigdreamer

I have inputs, they are bound to backend json fields. After pressing Send the screen should clear and allow the user to enter another record. How do I clear out all the entries on the screen for input fields once send is pushed.


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 9:54 am
by maxkatz

When you click send, run JavaScript and set all inputs to "", for example.


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 4:48 pm
by abigdreamer

I have two problems.

  1. I don't know javascript

  2. I don't know how to reference the objects on the form.

    Please thrown me a bone. Point me somewhere to figure this out.
    I learn fast.

    Mike


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 4:52 pm
by abigdreamer

How about an action that ties to the form.

and then somethinking like

formname.clear
formname.getkey('keyname')
formname.deleterec('recno')

Yes I need to learn javascript and jquerymobile.


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 5:31 pm
by abigdreamer

ok, I found this...
http://stackoverflow.com/questions/72...

It has things like ...$('.all_fields').val(''); where .all_fields is a class.
$('#formID')[0].reset(); --- this but I don't know the form id ... looking
$('input').val(''); --- and then this.

Now I have to try them.


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 5:58 pm
by abigdreamer

$('.live_form').val('');
This worked. (YEH)
but now to figure out how to reference forms and objects

My form is called Liveinvoicepage1 -- my item is called item1descript
how do I reset it back to 'Towing' its a DROP down now.
A select


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 6:13 pm
by Maryna Brodina

Hello! Working on it.


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 6:26 pm
by Ashton Stockman

You're looking for a jQuery selector by id. Something I've picked up working with this platform is that the id's of controls are always:

##page##_##control##

Where your page might be "homeScreen" and you're trying to select a button "buttonSubmit" for instance.

Using the above example, to reference the submit button directly, you'd use:

$("#homeScreen_buttonSubmit")

Your particular fix should be something like:

$("#Liveinvoicepage1_item1descript").val("Towing");

Let me know if that helps.


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Jul 24, 2013 6:32 pm
by Maryna Brodina

[quote:]$('input').val('')[/quote] means select all inputs and set property equal to empty line "". This method resets all inputs on all pages, not just the current one. It also resets all checkboxes and radiobuttons. It's better to do this way codeAppery("screenName").find("input[type=text]").val("");/code

[quote:]$('#formID')[0].reset()[/quote] if you create page inside the builder (not using HTML in panel) - there is no form on page, so you can't use this method

[quote:]$('.className').val('')[/quote] means select all elements with class all_fields and set property equal to empty line "". So in builder you can set className for inputs you need to reset and use this code

if item1descript is a select and you need to set any value try this code:
codeAppery("item1descript").val("Value");
Appery("item1descript").selectmenu('refresh');/code
where Value - value of item you set


How do I clear out inputs after the user pushes send and the job has been sent?

Posted: Wed Oct 23, 2013 9:41 am
by Johnny

Thank you for the code.

I needed it after logout and this works great :)
Appery("login").find("input[type=text]").val("");
Appery("login").find("input[type=password]").val("");