/ nomadnet / examples / various / input_fields.py
input_fields.py
 1  #!/usr/bin/env python3
 2  import os
 3  env_string = ""
 4  for e in os.environ:
 5    env_string += "{}={}\n".format(e, os.environ[e])
 6  
 7  template = """>Fields and Submitting Data
 8  
 9  Nomad Network let's you use simple input fields for submitting data to node-side applications. Submitted data, along with other session variables will be available to the node-side script / program as environment variables. This page contains a few examples.
10  
11  >> Read Environment Variables
12  
13  {@ENV}
14  >>Examples of Fields and Submissions
15  
16  The following section contains a simple set of fields, and a few different links that submit the field data in different ways.
17  
18  -=
19  
20  
21  >>>Text Fields
22  An input field    : `B444`<username`Entered data>`b
23  
24  An masked field   : `B444`<!|password`Value of Field>`b
25  
26  An small field    : `B444`<8|small`test>`b, and some more text.
27  
28  Two fields        : `B444`<8|one`One>`b `B444`<8|two`Two>`b
29  
30  The data can be `!`[submitted`:/page/input_fields.mu`username|two]`!.
31  
32  >> Checkbox Fields
33  
34  `B444`<?|sign_up|1|*`>`b Sign me up 
35  
36  >> Radio group
37  
38  Select your favorite color:
39  
40  `B900`<^|color|Red`>`b  Red
41  
42  `B090`<^|color|Green`>`b Green
43  
44  `B009`<^|color|Blue`>`b Blue
45  
46  
47  >>> Submitting data
48  
49  You can `!`[submit`:/page/input_fields.mu`one|password|small|color]`! other fields, or just `!`[a single one`:/page/input_fields.mu`username]`!
50  
51  Or simply `!`[submit them all`:/page/input_fields.mu`*]`!.
52  
53  Submission links can also `!`[include pre-configured variables`:/page/input_fields.mu`username|two|entitiy_id=4611|action=view]`!.
54  
55  Or take all fields and `!`[pre-configured variables`:/page/input_fields.mu`*|entitiy_id=4611|action=view]`!.
56  
57  Or only `!`[pre-configured variables`:/page/input_fields.mu`entitiy_id=4688|task=something]`!
58  
59  -=
60  
61  """
62  print(template.replace("{@ENV}", env_string))