WebCommon::incomingData(3) Returns all values for the specified key from user-supplied data

SYNOPSIS

[String] incomingData( String key, DataSource ds )

ARGUMENTS

key The key to retrieve data for

ds The source for user-supplied data

DESCRIPTION

Returns an array of all values for the key from the specified data source, or throws a WebCommon.NotIncoming(3kaya) Exception if no such key exists.


 // GET /example.cgi?a=1;b=3;b=5;z=;z;z
 vals = incomingData("a",DataGet);
 // vals = ["1"]
 vals = incomingData("b",DataGet);
 // vals = ["3","5"]
 vals = incomingData("c",DataGet);
 // NotIncoming exception thrown
 vals = incomingData("z",DataGet);
 // vals = ["","",""]

This is useful for processing the output from forms containing checkboxes with the same name or multiple selects.


 <form action='example.cgi' method='get'>
  <fieldset><legend>Example form</legend>
   <select multiple='multiple' name='a'>
    <option value='1'>Option 1</option>
    <option value='2'>Option 2</option>
    <option value='3'>Option 3</option>
    <option value='4'>Option 4</option>
   </select>
   <input type='submit' value='Test!'>
  </fieldset>
 </form>

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.

RELATED

WebCommon.DataSource(3kaya)

WebCommon.incomingExists(3kaya)

WebCommon.incomingKeys(3kaya)

WebCommon.incomingValue(3kaya)