Fetching form component values without submiting the form

You must Login before you can answer or comment on any questions.

Hi All

I have a small requirement that I am struck with.

THINGS DONE SO FAR: I have a created a form in Titanium using var form = forms.createForm({ style: forms.STYLE_LABEL, fields: fields });

It contains 2 text fields.

Say I enter some values in textfield1. Nw wen I click the 2nd textfield2, it sud take me to a search page say search.js. But I need to take the value in textfield1 which I entered and set it in Titanium.App.Properties.setString(textfield1, textfield1) so that I can retrieve it in search.js page.

QUESTION: Hw to fetch dis textfield1 value on click action on textfield2 without submiting the form.

Tnks in advance. Its seems trivial but I hav no clues. A sample code will be appreciated.

— asked 8 months ago by Sangram Jethy
1 Comment
  • we need abit of code for context here.... what is this?

    forms.createForm({ style: forms.STYLE_LABEL, fields: fields });

    — commented 8 months ago by Aaron Saunders

1 Answer

Hi Aaron

Tnks for yr reply. I am sorry for a late reply n also for not giving the additional details.

In my app.js

var forms = require('forms');

var fields = [ { title:'Name', type:'text', id:'name' }, { title:'Email', type:'email', id:'email' }]

var win = Ti.UI.createWindow();

var form = forms.createForm({ style: forms.STYLE_LABEL, fields: fields });

And form.js refer to the link

https://github.com/appcelerator-developer-relations/Forging-Titanium/blob/master/ep-010/Forms/Resources/forms.js

Question:

Say wen u enter name (textField 1) .

Nw wen u click on email (textBox 2) it wll take me to another page say search.js but I need to catch this name which I enter to be fetched on click action on email textbox. The click action code I added in my form.js page. Hw to fetch dis name value in my click action code?

Your Answer

Think you can help? Login to answer this question!