I am quite new to XForms so please bear over with me. I would like to know if following can be done:
I have an HTML form
<form>
<input type="text" name="search-string"/>
<input type="checkbox" name="search1" checked="checked" />Search option 1
<input type="checkbox" name="search2" checked="checked" />Search option 2
<input type="submit" />
</form>
I would like to represent this in XForms and on submit convert it to an XML element like this:
<data>
<search1>my search string</search1>
<search2>my search string</search2>
</data>
The search1 and search2 elements should only be set if the corresponding checkboxes are set, and they are both populated with the string from the search-string input.
When the data element has been constructed I need to send it through a POST http request.
Can all this be done using solely XForms or do I need to employ JS or something?
PS: I am using XSLTForms if it makes any difference.