NB WebForms Functions

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Locked
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

NB WebForms Functions

Post 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 :)
David Payer
Des Moines, Iowa
USA
User avatar
Wrangler
Posts: 1531
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA
Contact:

Re: NB WebForms Functions

Post by Wrangler »

Looks cool. Thanks, David!
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: NB WebForms Functions

Post by Neosoft Support »

Very cool!
NeoSoft Support
User avatar
andybrock
Posts: 181
Joined: Mon Apr 20, 2009 1:38 pm
Location: Somerset, UK
Contact:

Re: NB WebForms Functions

Post 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 :)
What I do and How I do it. - http://andybrocklehurst.com
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: NB WebForms Functions

Post 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
User avatar
Wrangler
Posts: 1531
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA
Contact:

Re: NB WebForms Functions

Post 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.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: NB WebForms Functions

Post 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.
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: NB WebForms Functions

Post 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
David Payer
Des Moines, Iowa
USA
robertpet
Posts: 10
Joined: Fri Aug 04, 2017 5:56 am

Re: NB WebForms Functions

Post by robertpet »

that's a good idea I will have to study the code --- you know your stuff !!!!!! 8)
Locked