Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>On the form's onSubmit event (or onChange for the inputs if you don't want a submit button), you can save the settings using the <a href="http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Database-module" rel="nofollow">Titanium.Database</a> or <a href="http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.App.Properties-module" rel="nofollow">Titanium.App.Properties</a> - I think the latter would be more appropriate in this case. Here would be an example in jQuery (for simplicity, though you could do it without):</p> <pre><code>$("form[name='settings']").submit(function(){ var val1 = $('input#inputOpt1').val(); Titanium.App.Properties.setString("opt1", val1); var val2 = $('input#inputOpt2').val(); Titanium.App.Properties.setString("opt2", val2); }); </code></pre> <p>Then, basically do the opposite for the other form to retrieve the Properties from Titanium and set the input field values.</p> <p><strong>UPDATE</strong></p> <p>The full example (again, not sure that I completely understand the desired interaction):</p> <pre><code>$(document).ready(function(){ $("form[name='settings'] input").change(function(){ // these will happen on every change to the input values var val1 = $('input#inputOpt1').val(); Titanium.App.Properties.setString("opt1", val1); var val2 = $('input#inputOpt2').val(); Titanium.App.Properties.setString("opt2", val2); }); // these will only happen right after the page loads var setting1 = Titanium.App.Properties.getString("opt1"); $("form#form op1").val(setting1); var setting2 = Titanium.App.Properties.getString("opt2"); $("form#form op2").val(setting2); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload