Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

submit botton

Status
Not open for further replies.

bebig

Technical User
Oct 21, 2004
111
US
I am working on "submit" botton.
I want to choose one of drop down lists, then send it to text.txt file.
Do you have any idea?
Thank you in advance.

-----------TCL/HTML------------------------------
puts "<table border=\"2\" style=\"border-collapse: collapse; font-family:Verdana; font-size:11px\" width=\"601\" id=\"table1\">\n"
puts "<center>\n"
puts " <tr>\n"
puts " <td width=\"151\">Auditorium $houseNumber</td>\n"
puts " <td width=\"93\">\n"
puts " <select size=\"1\" name=\"D5\" style=\"font-family: Verdana; font-size: 11px\">\n"
set num1 1
puts " <option>$num1</option>\n"
set num2 2
puts " <option>$num2</option>\n"
set num3 3
puts " <option>$num3</option>\n"
set num4 4
puts " <option>$num4</option>\n"
set num5 5
puts " <option>$num5</option>\n"
set num6 6
puts " <option>$num6</option>\n"
set numcommon "common"
puts " <option>$numcommon</option>\n"
puts " </select></td>\n"
puts " <td width=\"77\">$startTime</td>\n"
puts " <td width=\"64\">$closeTime</td>\n"
puts " <td width=\"200\"><select size=\"1\" name=\"D79\" style=\"font-family: Verdana; font-size: 11px\">\n"
 
Not sure what you want.
a) a menu where you choose an option and by that choice cause an action, or
b) a menu where you choose an option and elsewhere push a button to cause an action with the choice as an argument, or
c) a combo box where you choose an option with either of the above action invocations.

All are pretty simple and should probably start with a procedure that does the action you want, regardless of how it's invoked.

Bob Rashkin
rrashkin@csc.com
 
puts "<form name=\"send\" action=\"i3htmlexCopy.tcl\" method=\"post\">\n"

can I use this?
 
I tried it. but I could not close to the result.
I want to know about a menu where I choose an option and by that choice cause an action.

Thank you.

 
If you really want a menu (as opposed to a listbox) you use the "add" widget command:
$m add command -label "<what you want to call this option>" -command {...}
where $m is the path to the menu widget.

Bob Rashkin
rrashkin@csc.com
 
I want to select one value from one of the select option, and then send it to txt file.
for example,
first, I select $num1
then, I want to sumit this value to text.txt using TCL command. How to take this value after it selected?
second, how to make submit button?
Thank you.

puts "<form name=\"send\" action=\"i3htmlexCopy.tcl\" method=\"post\">\n"
puts " <select size=\"1\" name=\"house\" style=\"font-family: Verdana; font-size: 11px\">\n"
set num1 1
puts " <option value=$num1>1</option>\n"
set num2 2
puts " <option value=$num2>2</option>\n"
set num3 3
puts " <option value=$num3>3</option>\n"
set num4 4
puts " <option value=$num4>4</option>\n"
set num5 5
puts " <option value=$num5>5</option>\n"
set num6 6
puts " <option value=$num6>6</option>\n"
set numcommon "common"
puts " <option value=$numcommon>common</option>\n"
#---------------------------------------------
puts " </select></td>\n"
puts "</form>\n
 
OK. Here's one way to do what I think you want to do:
1. build a listbox with the values among which you want to select:
Code:
set w <frame where you want to put the listbox>
pack [listbox $w.lb1 -listvariable valuechoice -yscrollcommand "$w.sb1 set"] -side left
pack [scrollbar $w.sb1 -command "$w.lb1 yview] -side right -fill y
set valuechoice [list 1 2 3 4 5 6 7 8]

2. build a button to take the selected choice and output it
Code:
pack [button $w.b1 -text submit -command {subslct $w.lb1 $valuechoice}] -side top
proc subslct {wgt vlst} {
  set cprm [lindex $vlst [$wgt.curselection]]
  puts "   <option value=$cprm ...>"
}

There are, of course other ways to do this.

Bob Rashkin
rrashkin@csc.com
 
thank you for your response.
can you look over my code??
would you please tell me how to approach?
Thank you so much.
----this is code----
puts "<html>\n"
puts "<script>"
puts "<!--"
puts "function MM_openBrWindow(theURL,winName,features) { //v1.2"
puts "window.open(theURL,winName,features);"
puts "}//-->"
puts "</script>"
puts "<html>\n"
puts "\n"
puts "<head>\n"
puts "<meta http-equiv=\"Content-Language\" content=\"en-us\">\n"
puts "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n"
puts "<meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\">\n"
puts "<meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">\n"
puts "<title>i3 Data Table</title>\n"
puts "</head>\n"
puts "\n"
puts "<body>\n"
#--form
puts "<form name=\"send\" action=\" method=\"post\">\n"
#---
puts "<table border=\"2\" style=\"border-collapse: collapse; font-family:Verdana; font-size:11px\" width=\"70\" id=\"table1\">\n"
puts " <tr>\n"
puts " <td width=\"30\">Area</td>\n"
puts " <td width=\"40\">House Number</td>\n"
puts " </tr>\n"
####################################
set readFile [open "common.txt" "r+"]

gets $readFile line

while {![eof $readFile]} {

# write the line to the backup file "output this line to a file"
set lineList1 [string map {\" ""} $line]
set storeNum [lindex $lineList1 0]
set startTime [lindex $lineList1 1]
set closeTime [lindex $lineList1 2]
set storeList1 "$storeNum $startTime $closeTime"
#puts "$storeNum $startTime $closeTime"
lappend storeList $storeList1; #list of lists
gets $readFile line
}
#-----------for loop-----
set StoreName ""
set StoreId ""
set StoreNum ""

for {set i 0} {$i < [llength $storeList]} {incr i} {

if {$StoreId == [lindex [lindex $storeList $i] 0]} {
lappend store($StoreId) [lindex $storeList $i]

} else {
set StoreId [lindex [lindex $storeList $i] 0]
lappend store($StoreId) [lindex $storeList $i]
}

if {[lsearch -exact $StoreName store($StoreId)] == -1} {
lappend StoreName store($StoreId)
lappend StoreNum $StoreId
}
}

set StoreNum [lsort -index 0 $StoreNum]

foreach elem $StoreNum {
set ssL $store($elem)
set storeOpen($elem) [lsort -index 1 $ssL]
#--new
set open1 "[lindex $storeOpen($elem) 0]"
set openIndex1 [lindex $open1 0];#house number
set openIndex2 [lindex $open1 1];#earliest opening time
set storeClose($elem) [lsort -index 2 -decreasing $ssL]
#--new
set close1 "[lindex $storeClose($elem) 0]"
set closeIndex1 [lindex $close1 2
set houseNumber $openIndex1
set startTime $openIndex2
set closeTime $closeIndex1
#####################################################3
puts " <tr>\n"
puts " <td width=\"30\">Area$houseNumber</td>\n"
puts " <td width=\"40\">\n"
#--select----
puts " <INPUT TYPE=\"hidden\" NAME=\"droplist\" VALUE=\"0\">\n"
puts " <select size=\"1\" name=\"house\" style=\"font-family: Verdana; font-size: 11px\">\n"
set numDefault ""
puts " <option value=$numDefault></option>\n"
set num1 1
puts " <option value=$num1>1</option>\n"
set num2 2
puts " <option value=$num2>2</option>\n"
set num3 3
puts " <option value=$num3>3</option>\n"
set num4 4
puts " <option value=$num4>4</option>\n"
set num5 5
puts " <option value=$num5>5</option>\n"
set num6 6
puts " <option value=$num6>6</option>\n"
set numcommon "common"
puts " <option value=$numcommon>common</option>\n"
puts " </select></td>\n"
puts " </tr>\n"
#----------------end of startUp time
} ;#end of for loop
puts "</table>\n"
puts "<p><input type=\"button\" value=\"Save\" name=\"B3\" style=\"font-family: Verdana; font-size: 11px\">\n"
puts "</body>\n"
puts "</html>\n"
-----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top