Page 1 of 1

NB WebForms Functions

PostPosted: Wed Feb 20, 2013 3:23 pm
by dpayer
As part of a larger project, I have created a function that allows the dynamic creation of forms for data input and retrieval using a web browser object and HTML forms.
Image
The WebFormsCreate function will create a form based on field definition syntax that follows this pattern:
Field Label\:datatype Attributes Data1\,Data2\,Data3\;
with additional fields separated by the delimiter \;

The types of entry form include: text, dropdown, listbox listboxmulti (multiple selections), radio, checkbox, textarea, date, time, file, password, hidden, button, code (to insert code for scripts/CSS/HTML, etc within the form).

The forms that are created are (currently) less than stunning in appearance and are structured using tables but there are divs in the HTML that should allow for some basic CSS formating. Also, the templates that create the HTML can be modified to use a table less structure in the future.
Image

The WebFormsGetVal function is an NB based forms processor that will (currently) only process HTML forms made with the WebFormsCreate function. This processor retrieves the data of the submitted form and places the values in two variable arrays, one with the format fieldname=value; the other with the form fieldlabel=value.
Image

All required files (demo pub, functions, and some additional JS & CSS files plus small graphics can be downloaded here.
Unzip the file in a folder by itself, place the functions in your NB\Functions folder (where NB is installed) and open the demo.pub file to examine it and run the demo.

Comments are welcome. Suggestions for improvements are encouraged. Help with improving the form appearance with CSS would be great :)

Re: NB WebForms Functions

PostPosted: Thu Feb 21, 2013 8:46 am
by Wrangler
Looks cool. Thanks, David!

Re: NB WebForms Functions

PostPosted: Thu Feb 21, 2013 1:30 pm
by Neosoft Support
Very cool!

Re: NB WebForms Functions

PostPosted: Thu Apr 04, 2013 9:18 am
by andybrock
Been playing about with this - it's beyond cool. What a fantastic concept that opens up a lot of extra potential! Now I going to get my thinking cap on and come up with uses :)

Re: NB WebForms Functions

PostPosted: Sat Apr 06, 2013 7:43 am
by mishem
Hello
Check my code in the subroutines. discovered a
Code: Select all
StrReplace "[ThisFieldOPTIONS]" ", " "," "[ThisFieldOptions]" ""

But the space after the comma may be more than one?
I think it would be this:
Code: Select all
SearchStr ",[#32]" "[ThisFieldOPTIONS]" "[Result]" ""
While "[Result]" "<>" "0"
StrDel "[ThisFieldOPTIONS]" "[Result]+1" "1​​" "[ThisFieldOPTIONS]"
SearchStr ",[#32]" "[ThisFieldOPTIONS]" "[Result]" ""
EndWhile

Re: NB WebForms Functions

PostPosted: Sat Apr 06, 2013 8:14 am
by Wrangler
Code: Select all
StrReplace "[ThisFieldOPTIONS]" ", " "," "[ThisFieldOptions]" ""


You can have as many spaces as you want. Or tabs etc. You can also use the ascii symbols, but not necessary.

Re: NB WebForms Functions

PostPosted: Sat Apr 06, 2013 8:27 am
by mishem
Translation is perhaps not quite accurately conveys what I mean.

Code which is in the subroutine:
Code: Select all
StrReplace "[ThisFieldOPTIONS]" ", " "," "[ThisFieldOptions]" ""


Removes extra spaces if they are accidentally added. But the gap may be added not one, but 2.3 - ...
For example, the list looks like:
item 1
item 2
item 3

If you accidentally add a space, then the form of the list is changed and may look something like this
item 1
    item 2
  item 3

What would this did not happen as I understand it, and there is code in the subroutine:
Code: Select all
StrReplace "[ThisFieldOPTIONS]" ", " "," "[ThisFieldOptions]" ""


But it removes only one space. I proposed a version that will remove all the extra spaces.

Re: NB WebForms Functions

PostPosted: Sat Apr 06, 2013 9:23 am
by dpayer
mishem wrote:Hello
Check my code in the subroutines. discovered a
Code: Select all
StrReplace "[ThisFieldOPTIONS]" ", " "," "[ThisFieldOptions]" ""

But the space after the comma may be more than one?
I think it would be this:
Code: Select all
SearchStr ",[#32]" "[ThisFieldOPTIONS]" "[Result]" ""
While "[Result]" "<>" "0"
StrDel "[ThisFieldOPTIONS]" "[Result]+1" "1​​" "[ThisFieldOPTIONS]"
SearchStr ",[#32]" "[ThisFieldOPTIONS]" "[Result]" ""
EndWhile


This may be good.

If your input is well defined you will not have this kind of problem with too many spaces. I was attempting to do a clean up of the data but your method does the job well.

David

Re: NB WebForms Functions

PostPosted: Sun Aug 27, 2017 3:47 am
by robertpet
that's a good idea I will have to study the code --- you know your stuff !!!!!! 8)