Loading TOC...

xdmp:get-request-field-names

xdmp:get-request-field-names() as xs:string*

Summary

Returns a sequence of the request field names.

Example

xdmp:get-request-field-names()
=> ("section", "name", ...)

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • This function throws an error when I use a multi-select input field, e.g., movies[]
    • Could you provide more info about the error and how the request was made? (You'd have more formatting control on a Stack Overflow question tagged "marklogic", if that would help.)
      • The error is unfortunately thrown in a function from the MVC framework that was used for this application. I hesitate to edit the framework files, but if I must, I must. ADDENDUM: This is MarkLogic 5. declare function utils:get-request() as element(req:request) { element {fn:QName("http://marklogic.com/mvc/request","request")} { attribute method {fn:lower-case(xdmp:get-request-method())}, attribute rewrite-url {xdmp:get-request-url()}, attribute protocol {xdmp:get-request-protocol()}, attribute client-ip {xdmp:get-request-client-address()}, element req:status-code {200}, element req:message {"OK"}, element req:session { for $field in xdmp:get-session-field-names() return element {fn:concat("req:",fn:lower-case($field))} { xdmp:get-session-field($field) } }, element req:params { for $param in xdmp:get-request-field-names() where fn:not(fn:exists(xdmp:get-request-field-content-type($param))) return element {fn:concat("req:",fn:lower-case($param))} { attribute content-type {xdmp:get-request-field-content-type($param)}, for $value in xdmp:get-request-field($param) return element req:value {$value} } }, (: SOME MORE CODE HERE :) } }; Here is the full error message from the log: 2015-03-27 17:27:03.909 Notice: 8040-MYSITE-HTTP: XDMP-QNAMELEXFORM: for $param in xdmp:get-request-field-names() -- Invalid lexical form for QName 2015-03-27 17:27:03.909 Notice: 8040-MYSITE-HTTP: in /lib/mvc/common-mvc.xqy, at 35:8, 2015-03-27 17:27:03.909 Notice: 8040-MYSITE-HTTP: in utils:get-request() [1.0-ml] 2015-03-27 17:27:03.909 Notice: 8040-MYSITE-HTTP: $param = "book-category[]" 2015-03-27 17:27:03.909 Notice: 8040-MYSITE-HTTP: in /index.xqy, at 21:12 [1.0-ml]