SunQuest
           Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old December 12th, 2000, 02:28 PM
tbonds
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Here's my question. I have no problem reading in the name values from an HTML form object and storing the value in a text file. This is certainly easy enough to do with text boxes. But now I want to do the opposite. How can I use my text file, which contains the values from the original form controls, to populate the values of the form? Populating text fields should be easy, but what about setting the values of selectbox? For example, if I have 10 possible values for a selectbox, how can I set the value to be the one set by the user based on what's stored in the text file, without disturbing how I originally set up the form control, and while maintaining the other 9 choices that were not selected?

I want to do this because I have a customer input form that I want to read from/write to a text file. If the customer wants to change his personal info, I want to have the original form be repopulated from the file with the values he last entered(so he doesn't have to reinput the values all over again). They can then update anything they want in the form, and then form values will be resaved again to the text file with the updated form values replacing the old values.

Is there a tutorial that would show how to do this? Thanks.

Reply With Quote
  #2  
Old December 12th, 2000, 10:20 PM
vpopper's Avatar
vpopper vpopper is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: Southern California
Posts: 73 vpopper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 24 sec
Reputation Power: 9
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
$current_val = "Yes"; # or from your text file


$select = qq{<select name=something>n};
$select .= qq{<option value="" selected>Choose...n} unless $current_val;


foreach (qw(Yes No)) {
$select .= qq{<option value="$_"};
$select .= qq{ selected} if $_ eq $current_val;
$select .= qq{>$_n};
}


$select .= qq{</select>};
[/code]


[This message has been edited by vpopper (edited December 12, 2000).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Setting Values of FORM selectboxes with Perl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway