If I view a record and go back to my list on a master - detail setup, what is the best way to clear the fields so I get new values when i select my next record?
For selector you can use:
$("#fieldName option[code='S']").attr("selected", true); < --- If using code as identifier
$("#fieldName option[value='Small']").attr("selected", true); < ---- If using value as identifier
Is this a Mobile-Web version or Mobile (with the mobile builder)?
It will be a hybrid built through the the mobile designer.
I have a sample app creation document here that may help you to give a detailed info in creating navigation page.
You can see it in page 26. (see attachement)
Hope this may help.
Thank you for the document. I have that working fine in my application. What I would like to know is after I have viewed the details and I click back, I am selecting another record and going into those details instead of the logout like your example. If I do this, the details from the first record I viewed are still displayed instead of the details from my new record.
I have the same scenario if I say create a new task. It navigates me correctly where I want and creates the record, but if I immediately choose to crate another new task, it still has all the values from my last task in the fields.
Let me know if any of these doesn't make sense.
I see, i thought it was navigating into another record. You can clear it via Jquery Code.
1. Go to your Data Source of your Page.
2. Click on "DATA SOURCE EVENTS"
3. Select your data source and "Add Events"
Save and test.
I tried this code and am not having any luck getting the fields to clear out.
Here is the order I am running them in on my create datasource. It is creating the record perfectly and taking me to the page I want, but the fields are still populated when I return. Can you see something I have wrong?
try having "#" before the field names like $("#txt_subject").val(""); - this is for individual field.
If you want to clear ALL "input" and "textareas" HTML elements regardless their IDs and Names so use $("input").val(""); or $("textarea").val(""); - without "#" represents HTML elements
That worked to clear out my fields. Thank you!!
Can you tell me how to set the value on a selector? I want to reset it to always be the default value.
I tried using the value to set this to a default, but it doesn't appear to be working. I am also having trouble getting a label to be cleared out. See below for the information.
Selector is menu_priority
On Success of my create service this is run
After this runs, the input and textarea are cleared, but the label and the selector are not set as I hoped.
For picklist: changed "#" into element name because when I inspect element on it, it has different value on its ID. Change the "value" also into :contains(), values in the element are shown as ID and not the label. See image below.
$("select[name='select_name'] option:contains('Hot')").attr("selected", true);
For Label: changed the "#" into an element name as well and use .text() instead of .val(). In JQuery .val() is for use for elements of something you can input.