How to get the type of form elememts

Is it possible to get the type of form elements?

For example, if I am loop though a form as:

	var o = $$(form).getValues()
	for (var p in o){
		// if type is "text" then do something


You can use “name” property of the control.

var o = $$(form).getValues() for (var p in o){ var type = $$(p).name; ... }

Thank you, this is exactly that I needed.

Will the next version of Touch be released soon? The current version is doing everything I need at the moment, just curious if you’ll be releasing any new Components or Controls.

Is there a way to get the element type by inspecting the $$(‘form’) object itself?

Getting the type with: var type = $$§.name; works as long as p is unique even among page content replacements.

Often times I create a page with a form and then swap the form with a new form using:


where “new_content” is a new form.

If the original form and the new form have fields named the same, then $$(‘field’) will not work.

So if there is a way to get field type by inspecting the form structure?

I was trying to do something like:

if ( $$('formname').elements[p].something == 'text')

Ok…guess I should try the obvious!!!


This works well :smiley: