G'day,

I'm still relatively new working with XQuery, so if I've done something
blatantly and obviously wrong, please don't hurt me!

I'm building a webapp in pure XQuery, and using it to teach myself the
basics of XQuery.

I have a '/cluster-add.xqy', which looks at the value of a hidden value
(I need a better way to do it, but that's not critical) and switches
between a form and an xdmp:document-insert().  If the form has
method="get", nothing happens when I submit -- I just wind up back at an
unpopulated '/cluster-add.xqy'.  If I go to
'/cluster-add.xqy?aqt=1&name=Test&id=test', then the document-insert() runs.

My program, when stripped down to the bare essentials, looks like this.

return
if (xdmp:get-request-field('aqt'))
then
  (: inject content into the database :)
else
  (: generate form :)

The form itself looks like this.  I use Twitter Bootstrap to do styling.

<form action="/cluster-add.xqy" method="get" class="form-horizontal">
  <fieldset style="border: 0px;">
    <legend>Add cluster</legend>
    <div class="control-group">
      <label class="control-label" for="name">Name</label>
      <div class="controls">
        <input class="input-xlarge" id="name" type="text"/>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="id">Identifier</label>
      <div class="controls">
        <input class="input-xlarge" id="id"
               style="font-family:monospace;" type="text"/>
      </div>
    </div>
    <input type="hidden" id="aqt" value="1"/>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">Create</button>
      <button type="reset" class="btn">Reset</button>
    </div>
  </fieldset>
</form>

Any thoughts?

Thanks in advance,

Jashank

-- 
Jashank Jeremy
PGP: 0x25A5C309

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
General mailing list
[email protected]
http://community.marklogic.com/mailman/listinfo/general

Reply via email to