tkHTML

Check-in [b992a14631]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Changes to form submit logic. (CVS 1273)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b992a146316ef5c829a445f86257a44f52fa50e0
User & Date: danielk1977 2008-03-03 10:29:00.000
Context
2011-01-09
05:20
Remove a workaround for a bug in an old version of the http package. And change the "package require" command to make sure a sufficiently new version is loaded. Leaf check-in: 4ee7aaa953 user: dan tags: trunk
2008-03-03
10:29
Changes to form submit logic. (CVS 1273) check-in: b992a14631 user: danielk1977 tags: trunk
2008-03-02
15:00
Modifications so that the hv3 widget is easier to use. (CVS 1272) check-in: a6021ce249 user: danielk1977 tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to hv/hv3_form.tcl.
1
2
3
4
5
6
7
8
namespace eval hv3 { set {version($Id: hv3_form.tcl,v 1.98 2008/02/15 18:23:37 danielk1977 Exp $)} 1 }

###########################################################################
# hv3_form.tcl --
#
#     This file contains code to implement Html forms for Tkhtml based
#     browsers. The only requirement is that no other code register for
#     node-handler callbacks for <input>, <button> <select> or <textarea> 
|







1
2
3
4
5
6
7
8
namespace eval hv3 { set {version($Id: hv3_form.tcl,v 1.99 2008/03/03 10:29:00 danielk1977 Exp $)} 1 }

###########################################################################
# hv3_form.tcl --
#
#     This file contains code to implement Html forms for Tkhtml based
#     browsers. The only requirement is that no other code register for
#     node-handler callbacks for <input>, <button> <select> or <textarea> 
1363
1364
1365
1366
1367
1368
1369






1370
1371
1372
1373
1374
1375
1376
#    
snit::type ::hv3::form {

  # <FORM> element that corresponds to this object.
  variable myFormNode 

  variable myHv3







  option -getcmd  -default ""
  option -postcmd -default ""

  constructor {node hv3} {
    set myFormNode $node
    set myHv3 $hv3







>
>
>
>
>
>







1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
#    
snit::type ::hv3::form {

  # <FORM> element that corresponds to this object.
  variable myFormNode 

  variable myHv3

  # When the onsubmit() event is fired, this boolean variable is set.
  # If the event handler calls submit() on this form object, it is
  # submitted immediately, without running the event handler.
  #
  variable myInSubmitEvent 0

  option -getcmd  -default ""
  option -postcmd -default ""

  constructor {node hv3} {
    set myFormNode $node
    set myHv3 $hv3
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419


1420
1421
1422


1423
1424
1425
1426
1427
1428
1429
      }
    }
    set ret
  }

  method submit {submitcontrol} {

    # Before doing anything, execute the onsubmit event 
    # handlers, if any. If the submit handler script returns
    # false, do not submit the form. Otherwise, proceed.
    #


    set rc [[$myHv3 dom] event onsubmit $myFormNode]
    if {$rc eq "prevent"} return
    if {$rc eq "error"} return



    set SubmitControls [$self SubmitNodes]
    set Controls       [$self ControlNodes]

    set data [list]
    if {
        [lsearch $SubmitControls $submitcontrol] < 0 &&







|



>
>
|
|
|
>
>







1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
      }
    }
    set ret
  }

  method submit {submitcontrol} {

    # Before doing anything, execute the onsubmit event
    # handlers, if any. If the submit handler script returns
    # false, do not submit the form. Otherwise, proceed.
    #
    if {!$myInSubmitEvent} {
      set myInSubmitEvent 1
      set rc [[$myHv3 dom] event onsubmit $myFormNode]
      if {$rc eq "prevent"} return
      if {$rc eq "error"} return
      set myInSubmitEvent 0
    }

    set SubmitControls [$self SubmitNodes]
    set Controls       [$self ControlNodes]

    set data [list]
    if {
        [lsearch $SubmitControls $submitcontrol] < 0 &&
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
    if {$tag eq "input"} {
      set type [string tolower [$node attr -default {} type]]
    }

    switch -- ${tag}.${type} {

      select. {
        set hv3 [winfo parent [winfo parent $myHtml]]
        set control [::hv3::forms::select $zWinPath $node $hv3]
      }

      textarea. {
        set hv3 [winfo parent [winfo parent $myHtml]]
        set control [::hv3::forms::textarea $zWinPath $node $hv3]
      }

      input.image {
        set control [::hv3::clickcontrol %AUTO% $node]
        set myClickControls($node) $control
        $control configure -clickcmd submit
        set isSubmit 1







<
|



<
|







1664
1665
1666
1667
1668
1669
1670

1671
1672
1673
1674

1675
1676
1677
1678
1679
1680
1681
1682
    if {$tag eq "input"} {
      set type [string tolower [$node attr -default {} type]]
    }

    switch -- ${tag}.${type} {

      select. {

        set control [::hv3::forms::select $zWinPath $node $myHv3]
      }

      textarea. {

        set control [::hv3::forms::textarea $zWinPath $node $myHv3]
      }

      input.image {
        set control [::hv3::clickcontrol %AUTO% $node]
        set myClickControls($node) $control
        $control configure -clickcmd submit
        set isSubmit 1