Created
July 16, 2013 03:48
-
-
Save keithics/6005606 to your computer and use it in GitHub Desktop.
Serialize text inputs using Titanium - works with inputs and textarea for now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.mixin({ | |
serialize:function(el){ | |
var url = []; | |
_.map(el.getChildren(),function(value,key,el){ | |
if(!_.isUndefined(value.name)){ | |
url.push(value.name+ '=' + value.getValue()); | |
} | |
}); | |
return '?'+url.join('&'); | |
} | |
}); | |
/* | |
VIEW :: name to textfields are very important | |
<ScrollView id="scroller"> | |
<TextField id="email" hintText="Email" class="margint10" name="email"></TextField> | |
<TextField id="password" hintText="Password" class="margint10" name="password"></TextField> | |
</ScrollView> | |
*/ | |
urlencode = _($.scroller).serialize(); // ?email=&password= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment