I've not used the email type before but it seems to work so that if you were creating a proper html form with the submitted data being sent somewhere else it would check that what was entered here was in the correct format for an email address. This wouldn't really apply to this scenario as we're not properly 'submitting' data from a form. I would just leave any fields you want to be completed as the 'text' type.
I suspect what you might want though is for users to be able to complete more than one field on a page and have them saved to different variables. You'll need slightly different code for this:
1. Create as many variables as you need, each with a unique name and a default fixed value that can be used if the form isn't completed.
2. Create your fields in the html in this format, making sure that the names of the inputs match the variable names (e.g. a variable called 'email' would be entered in the input with the name 'email'):
Code:
<div id="myForm">
<p>Name:
<input name="name" type="text" />
</p>
<p>Email:
<input name="email" type="text" />
</p>
<p>Course:
<input name="course" type="text" />
</p>
<button id="submitBtn" onclick="submitForm('myForm')">Submit
</button>
</div>
3. Then paste these functions in the script optional property:
Code:
function lookupVar(id) {
for (var i=0; i<x_variables.length; i++) {
if (x_variables[i].name == id) {
return i;
break;
}
}
return null;
}
function submitForm(form) {
var $inputs = $('#' + form).find('input');
$inputs.each(function() {
var id = $(this).attr('name');
if ($(this).val() != '') {
var varIndex = lookupVar(id);
if (varIndex != null) {
x_variables[varIndex].value = $(this).val();
}
}
})
}
I hope this helps
Fay