No announcement yet.

Use HTML to create iput form?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Use HTML to create iput form?

    Still looking for a good way to input lots of data - is it possible to have my program write HTML form code and shoot it to some PB routine or third party add-on? Then, of course, I'd need a way to get the filled-out form data back into my program.

  • #2
    I sell a tool called PwrDev.
    In the new-project dialog i have two templates.
    One for frames and one for single dialog based.
    On my home page you can still find an older test version of this (simple executable link).
    Run, cklick set values, click submit and click home, this is a simple example, the values are obtained from html and kept in PowerBASIC variables.

    While it's a PwrDev thing, the actual stuff can also be done with plain coding.
    Depends on what you like of course.
    Last edited by Edwin Knoppert; 20 May 2008, 03:54 PM.


    • #3
      Isn't that "CGI" code? (I'm not a "CGI" guy).

      If so there should be a sample in your samples folder provided with the compiler.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]


      • #4
        Repeat after me: HTML forms don't suit for (massive) data input. It's slow as hell and PITA for every user in terms of usability.


        • #5



          • #6
            >Still looking for a good way to input lots of data

            With PB/CC, what could you do to improve on the ease of use and concomitant data entry speed of LOCATE + LINE INPUT?

            When LINE INPUT returns, you LOCATE at the next field on the screen and LINE INPUT again. Repeat until last field entered, save, refresh screen, go to field one.


            Um, this *is* a 'user enters the data' application, right?
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]


            • #7
              Data input

              A better way is to use WAITKEY$ or INKEY$
              You can validate each characters in real time and you can catch every keys and of course the mouse also.
              Old QB45 Programmer


              • #8
                Maybe this will give you some ideas.

                Attached Files
                Last edited by jcfuller; 21 May 2008, 12:06 PM. Reason: Attached File


                • #9
                  I render html within a browser and use a modified version of this.
                  Input forms can be created using html, but I don't like the slow routines.

                  #dim all '[B][COLOR=#ff0000]inputcc[/COLOR][/B].bas   
                  'this posting was some how deleted off forum so it was reposted 3/2/05
                  please post comments at: [URL=""][/URL] 
                  declare sub [B][COLOR=#ff0000]inputcc[/COLOR][/B](inputallowed$,mask$,answer$,lastkey$,fillchar%)
                  function pbmain&
                    dim phone$,amount$
                    color 7,1,1
                    print "[B][COLOR=#ff0000]inputcc[/COLOR][/B] (inputallowed$,mask$,answer$,lastkey$,fillchar%)
                    print "inputallowed$   keys allowed as input  0-9, a-z, a-z, yn, xx ,aa
                    print "mask$           string displayed with embedded chr$(fillchar%)
                    print "                mask$ can just be chr$(fillchar%) to fill in a form
                    print "answer$         characters typed by user
                    print "lastkey$        lastkey user pressed on exit
                    print "fillchar%       characters replaced with input
                    dim inputallowed$, mask$, answer$,lastkey$, fillchar%
                    inputallowed$ = "0123456789"
                    mask$ = "phone (___) ___-____"
                    fillchar% = asc("_")
                    locate 10,1  'where to begin
                    call [B][COLOR=#ff0000]inputcc[/COLOR][/B] (inputallowed$,mask$,phone$,lastkey$,fillchar%)
                    locate 10,29
                    mask$ = "enter amount $ ____.__"
                    call [B][COLOR=#ff0000]inputcc[/COLOR][/B] (inputallowed$,mask$,amount$,lastkey$,fillchar%)
                    locate 12,1
                    print "phone =  "phone$, "amount = "amount$
                  end function
                  sub [B][COLOR=#ff0000]inputcc[/COLOR][/B] (inputallowed$,mask$,answer$,lastkey$,fillchar%)
                      dim inputrow%, inputcolumn%, masklength%, cursorposition%
                      if fillchar% = 0 then fillchar% = asc("_")
                      inputrow% = cursory
                      inputcolumn% = cursorx
                      lastkey$ = "
                      masklength% = len(mask$)
                      cursorposition% = 0
                      answer$ = "
                      locate inputrow%, inputcolumn%
                      print mask$;
                      if lastkey$ = chr$(27) then exit sub
                      locate inputrow%, inputcolumn%
                      cursorposition% = instr(cursorposition% + 1, mask$ + chr$(fillchar%), chr$(fillchar%))
                      locate inputrow%,inputcolumn% + cursorposition - 1   'move right
                      if cursorposition% > masklength% then
                        gosub findcursorposition
                        exit sub
                      end if
                     lastkey$ = waitkey$         'release timeslices while waiting
                     if instr(inputallowed$, lastkey$) then
                        print lastkey$;
                        answer$ = answer$ + lastkey$
                        goto continueinput
                     end if
                     lastkey$ = right$(lastkey$, 1)
                     on instr(chr$(8) + chr$(119) + chr$(13) + chr$(27), lastkey$) goto backspace, startinput, enterpressed, startinput
                     if cursorposition% <= masklength% then goto getcharacter
                  exit sub
                     if len(answer$) = 0 then
                        goto getcharacter
                        locate inputrow%, inputcolumn%
                        answer$ = left$(answer$, len(answer$) - 1)
                        locate inputrow%,inputcolumn% + cursorposition -1      'move left
                        gosub findcursorposition
                        print chr$(fillchar%);
                        locate inputrow%, cursorx-1
                        goto getcharacter
                     end if
                     cursorposition% = cursorposition% - 1
                     locate inputrow%,cursorx-1
                     if mid$(mask$, cursorposition%, 1) <> chr$(fillchar%) then goto findcursorposition
                  end sub
                  The world is full of apathy, but who cares?