f



Accessing text form fields name=field[label]

I'm pretty much a JavaScript novice.  I'm good at learning by example 
and changing those examples  to suit my needs.  That said ....

..... I have some select fields in a form I created for a database search 
that I am unable to figure out how to access.  (The search is 
implemented in Php/MySQL.)

The user enters search values for: name, address1, city, ....  etc., 
..... and for each of these they also select whether the search should 
look for the field to be equal to, not equal to, Like, or Not Like the 
value in the database.

So in the form I have:
<input type=text name=city>
in combination with
<select name=func[city]>
<option value='='>=</option>
<option value='!='>!=</option>
<option value='LIKE'>LIKE</option>
<option value='!='NOT LIKE>NOT LIKE</option>
</select>

For an example, this search could be to find an entry "WHERE city 
$func[city]] $city.  (Php - e.g., WHERE city = 'Denver').  This works 
fine - in Php.  I use similar combinations for name, address, etc., ...

Okay, here's the JavaScript problem.  For the Reset action I have a 
JavaScript function to Reset all the form fields.  I want to Reset the 
selected indexes for the "func" fields (func[name], func[city], 
func[state], ...) using a loop that goes through the associative array, 
"func."  I cannot find the right syntax to address them as an array and 
I am beginning to think that JavaScript does not see them as an array.  
I could have just as well named them func_name, func_address, func_city, 
.....  (??)

I have already come up with a workaround.  I loop though *every* form 
element and if substring(0,5) = 'func[' I set the SelectedIndex for that 
element to 0.

What I would like is a definitive answer.  Am I correct that JavaScript 
does not see func as an array, or is there a syntax for accessing it 
that has so far totally eluded me.

I can access individual members of func like so:
alert (form["func[host_id]"].selectedIndex);
and that works, but I cannot figure out the correct syntax to loop 
through the array with:

for (x in form.func)

Is it simply not possible?  If it is possible, what is the correct 
syntax for::

// within a function where form is an input = document.theform
for (x in form.func)  // I also tried for (x in form["func"])
{
   alert (x);
   form.func[x].SelectedIndex = 0;
}

I put the alert in that loop for testing and it never seems to even 
enter the loop.

Can this be done the way I want to do it?

Thanks in Advance for any help.

-- 
*****************************
 Chuck Anderson • Boulder, CO
 http://www.CycleTourist.com
*****************************
0
7/22/2006 2:15:36 AM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

7 Replies
800 Views

Similar Articles

[PageSpeed] 52

I goofed the Subject.  It should actually be

Accessing *select* form fields name=field[label] 
(select, not text fields)

Chuck Anderson wrote:
> I'm pretty much a JavaScript novice.  I'm good at learning by example 
> and changing those examples  to suit my needs.  That said ....
>
> .... I have some select fields in a form I created for a database search 
> that I am unable to figure out how to access.  (The search is 
> implemented in Php/MySQL.)
>
> The user enters search values for: name, address1, city, ....  etc., 
> .... and for each of these they also select whether the search should 
> look for the field to be equal to, not equal to, Like, or Not Like the 
> value in the database.
>
> So in the form I have:
> <input type=text name=city>
> in combination with
> <select name=func[city]>
> <option value='='>=</option>
> <option value='!='>!=</option>
> <option value='LIKE'>LIKE</option>
> <option value='!='NOT LIKE>NOT LIKE</option>
> </select>
>
> For an example, this search could be to find an entry "WHERE city 
> $func[city]] $city.  (Php - e.g., WHERE city = 'Denver').  This works 
> fine - in Php.  I use similar combinations for name, address, etc., ...
>
> Okay, here's the JavaScript problem.  For the Reset action I have a 
> JavaScript function to Reset all the form fields.  I want to Reset the 
> selected indexes for the "func" fields (func[name], func[city], 
> func[state], ...) using a loop that goes through the associative array, 
> "func."  I cannot find the right syntax to address them as an array and 
> I am beginning to think that JavaScript does not see them as an array.  
> I could have just as well named them func_name, func_address, func_city, 
> ....  (??)
>
> I have already come up with a workaround.  I loop though *every* form 
> element and if substring(0,5) = 'func[' I set the SelectedIndex for that 
> element to 0.
>
> What I would like is a definitive answer.  Am I correct that JavaScript 
> does not see func as an array, or is there a syntax for accessing it 
> that has so far totally eluded me.
>
> I can access individual members of func like so:
> alert (form["func[host_id]"].selectedIndex);
> and that works, but I cannot figure out the correct syntax to loop 
> through the array with:
>
> for (x in form.func)
>
> Is it simply not possible?  If it is possible, what is the correct 
> syntax for::
>
> // within a function where form is an input = document.theform
> for (x in form.func)  // I also tried for (x in form["func"])
> {
>    alert (x);
>    form.func[x].SelectedIndex = 0;
> }
>
> I put the alert in that loop for testing and it never seems to even 
> enter the loop.
>
> Can this be done the way I want to do it?
>
> Thanks in Advance for any help.
>
>   


-- 
*****************************
 Chuck Anderson • Boulder, CO
 http://www.CycleTourist.com
 Everyone's journey should be different,
 so that we all are enriched
 in new and endless ways
*****************************
0
Chuck
7/22/2006 2:17:41 AM
Chuck Anderson wrote:
> I'm pretty much a JavaScript novice.  I'm good at learning by example 
> and changing those examples  to suit my needs.  That said ....
> 
> .... I have some select fields in a form I created for a database search 
> that I am unable to figure out how to access.  (The search is 
> implemented in Php/MySQL.)
> 
> The user enters search values for: name, address1, city, ....  etc., 
> .... and for each of these they also select whether the search should 
> look for the field to be equal to, not equal to, Like, or Not Like the 
> value in the database.
> 
> So in the form I have:
> <input type=text name=city>
> in combination with
> <select name=func[city]>

You should always quote attribute values in HTML - though it's not 
always necessary, it saves having to remember which characters to quote 
- the '[' and ']' characters must be quoted.

   "In certain cases, authors may specify the value of an attribute
    without any quotation marks. The attribute value may only contain
    letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
    periods (ASCII decimal 46), underscores (ASCII decimal 95), and
    colons (ASCII decimal 58). We recommend using quotation marks even
    when it is possible to eliminate them."
    <URL:http://www.w3.org/TR/html4/intro/sgmltut.html#attributes>


> <option value='='>=</option>
> <option value='!='>!=</option>
> <option value='LIKE'>LIKE</option>
> <option value='!='NOT LIKE>NOT LIKE</option>

You possibly meant:

   <option value='NOT LIKE'>NOT LIKE</option>


> </select>
> 
> For an example, this search could be to find an entry "WHERE city 
> $func[city]] $city.  (Php - e.g., WHERE city = 'Denver').  This works 
> fine - in Php.  I use similar combinations for name, address, etc., ...
> 
> Okay, here's the JavaScript problem.  For the Reset action I have a 
> JavaScript function to Reset all the form fields.  I want to Reset the

Why can't you use a plain reset button?  No script required.


> selected indexes for the "func" fields (func[name], func[city], 
> func[state], ...) using a loop that goes through the associative array, 
> "func."  I cannot find the right syntax to address them as an array and 

There is no 'associative array' func unless you have created it elsewhere.


> I am beginning to think that JavaScript does not see them as an array.  

No, it doesn't.  However, the option elements of a select are held in a 
collection called options - but they don't have a reset method.


> I could have just as well named them func_name, func_address, func_city, 
> ....  (??)
> 
> I have already come up with a workaround.  I loop though *every* form 
> element and if substring(0,5) = 'func[' I set the SelectedIndex for that 
> element to 0.

The obvious solution is:

   <input type="reset">


If you insist on using JavaScript then call the form's reset method:

    document.forms['formName'].reset();


> What I would like is a definitive answer.  Am I correct that JavaScript 
> does not see func as an array, or is there a syntax for accessing it 
> that has so far totally eluded me.

See above.


> I can access individual members of func like so:
> alert (form["func[host_id]"].selectedIndex);
> and that works, but I cannot figure out the correct syntax to loop 
> through the array with:
> 
> for (x in form.func)

Looping through the options is unnecessary. Say you have:

<form name="formA" action="">
  <select name="selA">
   <option selected>one
   <option>two
   <option>three
  </select>
  <input type="reset">
  <input type="button" value="Reset using script"
   onclick="this.form.reset();">
  <input type="button" value="Select two"
   onclick="this.form.elements['selA'].selectedIndex = 1;">
</form>

Clicking the reset button will reset the form.  To do it with script, 
click the "Reset using script" button.

To set option 1 (the second one) as selected, click the "Select two" button.

To loop through all the options - which seems pointless, but what the 
heck :-) - do something like:

   var options = document.forms['formA'].elements['selA'].options;
   for (var i=0, len=options.length; i<len; i++){
     alert('Option ' + i + ': ' + options[i].value)
   }

[...]

-- 
Rob
0
RobG
7/22/2006 3:12:38 AM
RobG wrote:
[...]

> To loop through all the options - which seems pointless, but what the 
> heck :-) - do something like:
> 
>   var options = document.forms['formA'].elements['selA'].options;
>   for (var i=0, len=options.length; i<len; i++){
>     alert('Option ' + i + ': ' + options[i].value)

Sorry, IE won't like that - if an option has no value attribute, IE 
wants the text explicitly:

       alert('Option ' + i + ': ' + options[i].text)


-- 
Rob
0
RobG
7/22/2006 3:41:41 AM
RobG said the following on 7/21/2006 11:41 PM:
> RobG wrote:
> [...]
> 
>> To loop through all the options - which seems pointless, but what the 
>> heck :-) - do something like:
>>
>>   var options = document.forms['formA'].elements['selA'].options;
>>   for (var i=0, len=options.length; i<len; i++){
>>     alert('Option ' + i + ': ' + options[i].value)
> 
> Sorry, IE won't like that - if an option has no value attribute, IE 
> wants the text explicitly:
> 
>       alert('Option ' + i + ': ' + options[i].text)

I have never understood what a select list without values was good for.

-- 
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
0
Randy
7/22/2006 9:06:18 AM
JRS:  In article <44c197ef$0$23507$5a62ac22@per-qv1-newsreader-
01.iinet.net.au>, dated Sat, 22 Jul 2006 13:12:38 remote, seen in
news:comp.lang.javascript, RobG <rgqld@iinet.net.au> posted :
>
>You should always quote attribute values in HTML - though it's not 
>always necessary, it saves having to remember which characters to quote 

ISTM that it's very easy to remember that alphanumerics (A-Za-z0-9)
don't need quoting, and that ordinary numeric values (such as -99.5)
don't need quoting; and that URLs *should* be quoted.

That leads, AFAICS, to quoting everything that needs it, and not too
much else (I'm aware that what follows href= sometimes does not *need*
quoting).

When HTML is being written out from javascript strings, knowing that
simple cases do not need quoting saves having to remember to alternate
or escape the quotes you don't need.


IIRC, there is an argument that moving on from HTML to some other
acronym will mean adding those quotes; but it will mean many other
changes too, and an experienced RegExp user should be able to do the
vast bulk of the extra quoting with an editing tool.

-- 
 � John Stockton, Surrey, UK.  ?@merlyn.demon.co.uk   Turnpike v4.00   IE 4 �
 <URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript 
 <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
 <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
0
Dr
7/22/2006 8:44:36 PM
First off, thanks for your help (reply interspersed).

RobG wrote:
> Chuck Anderson wrote:
>   
>> I'm pretty much a JavaScript novice.  I'm good at learning by example 
>> and changing those examples  to suit my needs.  That said ....
>>
>> .... I have some select fields in a form I created for a database search 
>> that I am unable to figure out how to access.  (The search is 
>> implemented in Php/MySQL.)
>>
>> The user enters search values for: name, address1, city, ....  etc., 
>> .... and for each of these they also select whether the search should 
>> look for the field to be equal to, not equal to, Like, or Not Like the 
>> value in the database.
>>
>> So in the form I have:
>> <input type=text name=city>
>> in combination with
>> <select name=func[city]>
>>     
>
> You should always quote attribute values in HTML - though it's not 
> always necessary, it saves having to remember which characters to quote 
> - the '[' and ']' characters must be quoted.
>
>    "In certain cases, authors may specify the value of an attribute
>     without any quotation marks. The attribute value may only contain
>     letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
>     periods (ASCII decimal 46), underscores (ASCII decimal 95), and
>     colons (ASCII decimal 58). We recommend using quotation marks even
>     when it is possible to eliminate them."
>     <URL:http://www.w3.org/TR/html4/intro/sgmltut.html#attributes>
>   
Oh yeah.  I am aware of this and choose not to quote strictly 
alphanumeric attributes, ... and I almost always remember to quote any 
attributes containing other characters (like % or [ or ] ).  Somehow I 
forgot about that in this case.

>> <option value='='>=</option>
>> <option value='!='>!=</option>
>> <option value='LIKE'>LIKE</option>
>> <option value='!='NOT LIKE>NOT LIKE</option>
>>     
>
> You possibly meant:
>
>    <option value='NOT LIKE'>NOT LIKE</option>
>
>
>   
Yep, just a mistype.
>> </select>
>>
>> For an example, this search could be to find an entry "WHERE city 
>> $func[city]] $city.  (Php - e.g., WHERE city = 'Denver').  This works 
>> fine - in Php.  I use similar combinations for name, address, etc., ...
>>
>> Okay, here's the JavaScript problem.  For the Reset action I have a 
>> JavaScript function to Reset all the form fields.  I want to Reset the
>>     
>
> Why can't you use a plain reset button?  No script required.
>   
When the user Submits the search, the search page reloads itself, 
re-displays the search form with the search criteria displayed in the 
form, and displays the search results under that.  At that point I want 
Reset to to set to set all text fields back to blank and the comparator 
function fields back to '=', but what it does at this point is Reset 
them to the values that were set when the page reloaded itself.  I want 
them to go back to blank, so I have a function do it.
>   
>> selected indexes for the "func" fields (func[name], func[city], 
>> func[state], ...) using a loop that goes through the associative array, 
>> "func."  I cannot find the right syntax to address them as an array and 
>>     
>
> There is no 'associative array' func unless you have created it elsewhere.
>
>   
>> I am beginning to think that JavaScript does not see them as an array.  
>>     
>
> No, it doesn't.  
That's the key point for me.  I can quit beating my head against the 
wall and use my "workaround."

> However, the option elements of a select are held in a 
> collection called options - but they don't have a reset method.
>   
>   
>> I can access individual members of func like so:
>> alert (form["func[host_id]"].selectedIndex);
>> and that works, but I cannot figure out the correct syntax to loop 
>> through the array with:
>>
>> for (x in form.func)
>>     
>
> Looping through the options is unnecessary.
>   
Correct.  And I don't need or want to, either.  Although you've shown me 
one more thing about JavaScript and forms I did not know.  .option.
> <form name="formA" action="">
>   <select name="selA">
>    <option selected>one
>    <option>two
>    <option>three
>   </select>
>   <input type="reset">
>   <input type="button" value="Reset using script"
>    onclick="this.form.reset();">
>   <input type="button" value="Select two"
>    onclick="this.form.elements['selA'].selectedIndex = 1;">
> </form>
>
> Clicking the reset button will reset the form.  To do it with script, 
> click the "Reset using script" button.
>
> To set option 1 (the second one) as selected, click the "Select two" button.
>
> To loop through all the options - which seems pointless, but what the 
> heck :-) - do something like:
>
>    var options = document.forms['formA'].elements['selA'].options;
>    for (var i=0, len=options.length; i<len; i++){
>      alert('Option ' + i + ': ' + options[i].value)
>    }
>
> [...]
>
>   


-- 
*****************************
 Chuck Anderson • Boulder, CO
 http://www.CycleTourist.com
*****************************
0
Chuck
7/22/2006 10:24:41 PM
Chuck Anderson wrote:
> First off, thanks for your help (reply interspersed).
> 
> RobG wrote:
>> Chuck Anderson wrote:
[...]
>> Why can't you use a plain reset button?  No script required.
>>   
> When the user Submits the search, the search page reloads itself, 
> re-displays the search form with the search criteria displayed in the 
> form, and displays the search results under that.  At that point I want 
> Reset to to set to set all text fields back to blank and the comparator 
> function fields back to '=', but what it does at this point is Reset 
> them to the values that were set when the page reloaded itself.  I want 
> them to go back to blank, so I have a function do it.

Then I guess using the form's reset method would be best.  You can call 
it using body/window onload or use a script element immediately below 
the form.

The problem with onload is that the form may display un-reset for some 
time before the page finishes loading, then it will reset.

[...]

>>> I am beginning to think that JavaScript does not see them as an 
>>> array.      
>>
>> No, it doesn't.  
> That's the key point for me.  I can quit beating my head against the 
> wall and use my "workaround."

I probably should have written "Yes, it doesn't".  English is a strange 
language.  ;-)

[...]


-- 
Rob
0
RobG
7/23/2006 5:08:33 AM
Reply:

Similar Artilces:

How To access form name if there's a form field named "name"
Hi Everybody, Can someone please tell me how to access the form name if there's a form field named "name", for example: <form name="myform"> <input type="text" name="name" value="Marc"> <input type="button" onClick="alert(this.form.name);"> </form> When I do this, the alert shows "[object HTMLInputObject]" (in firefox) or just "[object]" (in ie6) instead of the string "myform". the problem is that I access the form element named "name" instead of the ...

Form fields to same field
I have a form to be completed by a teacher. They are to input 30 grades on the form (along with teacher name, period number, etc). This will store all 30 grades in one field in my sql table. The multiple forms into one field has me baffled. I am a newbie but appreciate all the help! Thanks in advance. >I have a form to be completed by a teacher. They are to input 30 >grades on the form (along with teacher name, period number, etc). This >will store all 30 grades in one field in my sql table. Is that 1 grade each for 30 students? Better be sure you keep the order straight if so, a...

copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation
I have a web form with several fields. If I copy & paste from a RTF document into a field, the javascript validation and field length are bypassed and cause the form to fail. Any ideas? In article <m1toc.2789$yF6.883@bignews5.bellsouth.net>, noname@nonegiven.net enlightened us with... > I have a web form with several fields. If I copy & paste from a RTF > document into a field, the javascript validation and field length are > bypassed and cause the form to fail. > > Any ideas? Code better? (I have no clue. I've never heard of such a thing. Post code s...

ADO
I am using VB6 and Access 97 via ADO. My question is this: I have a variable (txtFieldName) that contains the name of a field in an already created record set. I would like to access that field in the record set using the variable name. Is this possible with Visual Basic? I come from a Clipper background and things like this are possible. Thanks in advance for any help you can give me. Bill Something like: Dim txtFieldName as string Dim txtFieldVal as string txtFieldName = "FirstName" txtFieldValue = RSTrecordset.fields(txtFieldName) ***** ---I know I ...

Read form "name" attribute when it contains form field with name "name"
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the document. In order to identify them, I read their "name" property (which sources from "name" HTML attribue). The problem is, that if the form contains form control named "name", it overwrites the form name property. In fact, I'm quite surprised that it's so easy to spoil any of the form object properties - the form just needs to contain a field named, say, "onsubmit", and - voila - it's done! Also, if t...

Form field value into another form field?
I have a form that submits some js created data through a formmail script. One field of the form is a text box for the person's name. I'd like the subject line of the resulting email to be "Some Specific Text " + the_name. I believe it's possible, but am lost as to the strategy? TIA, Larry L Simple: documet.FORMNAME.ELEMENTNAME.value='YOUR TEXT HERE'+documet.FORMNAME.ELEMENTNAME.value; Danny On Thu, 30 Jun 2005 19:51:34 -0700, Larry <noway@none.com> wrote: > I have a form that submits some js created data through a formmail > ...

radio button make text field equal value of form field
What I am trying to do is when someone clicks on the YES radio button I want the text field called MYTEXT to equal the text field named DATE. The below code works as long as I do NOT UN-COMMENT the NO radio button, once I do that it will not work. Any help would be greatly appreciated. Mitch <body> <script language="JavaScript"><!-- function setField(what) { if (what.myTick.checked) what.myText.value = what.date.value; else what.myText.value = ''; } //--></script> <form> <p> Yes <input name="myTick&quo...

SQL Server View integer field shows as text field in Access
Hi All! I have an SQL Server View where my field in the view is an integer field and works well. When I link to it from Access, the field is defined as a text field in Access. Does anyone have any idea why this is happening or how to fix it? Thanks in advance! KB On Sun, 3 Aug 2008 20:31:43 -0700 (PDT), kevinfbutt <kevin.butt@iavalley.edu> wrote: That's quite unusual. Can you post the SQL for that field in that view? What version of Access and SQL Server? Fully patched? Can you replicate the problem with a view in one of the SQL Server sample databases? -Tom. Microsoft Access ...

Accessing fields in RECORD data type using variables as field names
Hi, I am trying to write a generic audit-trail trigger function which will record changes on a field-by-field basis to a single table for all audited tables. However, I find that I can only access a field in OLD and NEW if I know the name in advance. Is there any way I can access the fields when I only have a variable containing the name of the field? If I can do this, I can make a really simple, schema-change-resistent, low storage size audit trail for high read / low change databases. Alistair this is what I want to do: FOR mcolumn IN EXECUTE ''SELECT col FRO...

Extracting Table Names/Field Names/Field Types?
I'm writing a metadata app and need to load a few hundred tables from an Oracle DB. Right now, I'm firing up MS Access and writing DAO code to loop through the ODBC connections. Works ok, but doesn't return the "real" Oracle field types (e.g. "VARCHAR (24)". Is there some syntax I can use in PL-SQL that will let return this info in a recordset? -- PeteCresswell (Pete Cresswell) wrote: > I'm writing a metadata app and need to load a few hundred tables from an Oracle > DB. > > Right now, I'm firing up MS Access and writing DAO code to loop through the ODBC > connections. Works ok, but doesn't return the "real" Oracle field types (e.g. > "VARCHAR (24)". > > Is there some syntax I can use in PL-SQL that will let return this info in a > recordset? Congratulations on your attempt to reinvent the wheel ... you are in excellent company no doubt. Likely everything you are trying to do has been done by Oracle for far more than a decade and can be found in user_all_tables, user_tab_columns, user_tab_partitions, user_tab_subpartitions, and user_lob_subpartitions. -- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan@x.washington.edu (replace 'x' with a 'u' to reply) ...

multiple conditions in a join, access doesn't like on (table1.field=table2.field and table1.field=table3.field)
Hi I have written the following query and am having problems with the last outer join in ms access... it doesn't like the multiple conditions that I have in there, if I have just one or the other its OK but not both... and I have tried putting the second condition in a where clause but then i don't get an outer join i'm pulling my hair out on this one... i would be extremely greatful for some ideas... SELECT ro.thickness,ro.width,ro.grade,sum(ro.pcs) as pieces, ro.length,GT.thicknessid,t.thicknessid,gt.gradethicknessgroupid, gtd.gradeid, gr.gradeid FROM(((NewOrders as RO LEFT O...

text fields to memo field
Is there a way to combine text fields into one memo field? This is an existing database. Some people in the database may have several "contact" entries where they have a "note" in a text field. I would like to figure a way to combine all the "note" fields for each person into one memo field. Thank you "RR" <texson552000@yahoo.com> wrote in message news:<S6HRb.969$ee6.74@fe2.texas.rr.com>... > Is there a way to combine text fields into one memo field? > > This is an existing database. Some people in the database may have seve...

validating a form, one required field , another field if searched on requires both fields
I have a search form in php and mysql. There is only one required field the 'bu'. The validation message doesn't display when I submit the search form if I don't have a 'bu' selected? So something is wrong with the javascript. Also, if the user wants to search on zoneid then they must also input a zonenm. The bu is always required. How do I validate for if there is a zoneid the zonenm is required? The get_bu function just pulls up a value list of the bu's in the database. The form works for the search I just need the input validated. thanks, ---javascript------ <script language='javascript'> function validate_form(thisform) { var sMsg=''; var sSel='N'; with (thisform) { if ( bu.value=='' ) { sMsg+="No bu\r\n"; } for (i = 1; i < bu.length; i++) { if ( bu[i].selected) { sSel='Y'; } } if ( sSel=='N' ) { sMsg+="No BU selected\r\n"; } if ( sMsg.length > 0 ) { alert(sMsg); return false; }else{ return true; } } } </script> ---form----- <form action='$me' method='post' onsubmit='return validate_form(this);'> <td><table cellpadding='3' cellspacing='0' border='0' style='border: 1px solid #CCCCCC' align='center'>\n <th colspan='2'><span class='ast'>*</span>Search for Labels to Print\n <tr>\n <th align='right'><span class=...

JavaScript script to parse text fields from multipart/form-data
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to parse the filename. <form name='form1' method='POST' enctype='multipart/form-data' action='sub.asp'> <input type='text' name='title1' value='value1'> <input type='file' name='file1'> </form> I found a great ASP VBScript for uploading files, but the rest of my Web site is coded in ASP usi...

concatenate in Javascript function? simple field validation funciton not working
I have a field called telephone whose ONBLUR action is to call a javascript function: validatePhoneNumber(telephone) The non-working function is: function validatePhoneNumber(v) { var phone =document.form. + v + .value; //HERE"S WHAT IS NOT WORKING var stripped = phone.replace(/[\(\)\.\-\ ]/g, ''); .........//code left out for clarity document.form. + v + .focus() } I want to reuse the function so I need to make it generic. Any ideas? Many thanks. The first line in your function i...

Storing form field names in an array and writing values to a text file
Hi, Am I trying to be too clever here? I am trying to write a PHP page to enable me to enter values into a form then write those values to a text file. I want to use the form & table that displays these fileds and values in different ways so am creating one page and parsing variables to it. The problem appears to be in trying to write the values to a text file. The page displays the field names correctly but when I submit the form and try to write the values to a text file, separated by # what I get is ############## but no values !!! Any help greatly appreciated .... Paul. Config.ph...

Access Forms: Set different field background color based on text box value
Hi all, I am trying to set different background color based on text box value on a form. Basically, I have one form that display many lines of records(record source is a query), in each of the lines, if a text box named "status" is "C", THe line will be shown in green, else in red. Can this be done? ANyone can help me with this? Rgds, Vic See: http://www.lebans.com/conditionalformatting.htm -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org....

Linking A Text Field With A Number Field
Is there any way to link a field I'll call StudentId in Table1 with StudentId in Table2? In Table1, StudentId is a number and in Table2 it's a text field. The values match up fine so other than one being a number and the other a text field, everything else would be okay. I know I can create an append query to copy, say, Table2 to e.g. Table3 and make StudentId a number field in Student3 but wondered if there's a more "elegant" solution. Thanks, Sheldon Potolsky On Mar 6, 11:42=A0am, Sheldon <SHPsalm...@aol.com> wrote: > Is there any way to link a field I...

Changing drop-down field to text field.
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic SFSB and, from there, to the database. On the front end, all cells appear as text fields. However, for certain cells, when the user clicks on the cell, the text field turns into a drop-down field (i.e. Select object), defaulting to the value in the text field (unless the field is blank, in which case the drop-down defaults to the first entry in the drop-down). Once the user has selected a new en...

How to convert Number Field to Text Field
I'm newbie in Filemaker, currently I'm using Filemaker pro v 6.01 on Windows XP. I have a small problem. I'm trying to make a solution for Hotel Rate. I want to change the USD. 0.00 to "Included" for breakfast rate which already included in the room rate. Anybody can help, will be much appreciated. Thanks. "Adhie" <priyadi77@yahoo.com> wrote in message news:ba1b5c27.0404080446.21e110b2@posting.google.com... > I'm newbie in Filemaker, currently I'm using Filemaker pro v 6.01 on > Windows XP. I have a small problem. I'm trying to make a ...

Changing Text Field to ported field
I did a search, and maybe I'm looking things up using the wrong criteria. I apologize if this has been discussed before, and if it has, please let me know where to find it. Thanks. FMPro V6.04 Windows XP Our users are currently entering in all SW code associated with a problem into a text field, using paragraph returns or comma's as delimiters. To make metric gathering more useful, I created a child database to collect the SW mods individually (with all the details that go with them), and have created portal on my main database to this child database so that they can enter in the ...

Display name of field if field is empty
Is there a way to display the name of the field if the field is empty? If there was any way to have it display as it does in layout mode, that would be perfect. Any suggestions appreciated. You can only do this with a work around. For MyField in MyTable Create a textobject with the required text Set textcolor to whatever color you want Set the background color to the color that lays behind (or leave it transparent) Create a conditional format for the object. Formula is not IsEmpty ( MyTable::MyField ) Set the conditional text color to the backgroundcolor Make the background of Myfield ...

text fields in a form
Thanks in advance for any solutions to my query. My users log into a site with their domain e-mail (someone@domain.com) and password. I'd like to tweak the form so that the @domain.com portion will already be included. I can do this easily using a value="domain.com" following the text input tags but then that variable shows up in the text box. I'd rather that value (domain.com) be hidden and I can't figure out how. A minor point you say, yes, but one I'd like to fix. In other words, the user types his/her userID "someone" and the form append...

no format assignment for a form's textbox control... Access assumes control's data is going to be placed in a finite length text field of a table
I have a form with two controls: [Forms]![frmMainMenu]![RootTable] - combo box [Forms]![frmMainMenu]![BodyTextHere] - text box A button on the form tries to run this SQL when clicked... INSERT INTO BodyMsgsSent (ToWhom, BodyText) SELECT DISTINCTROW [Forms]![frmMainMenu]![RootTable] AS MyTargets, [Forms]![frmMainMenu]![BodyTextHere] AS MyList; When the SQL runs, it fails with msg saying "Field length is too long". I don't know why, because BodyMsgsSent.BodyTextHere is a memo-type field. If the string I type in [Forms]![frmMainMenu]![BodyTextHere] is very short, the error does no...

Web resources about - Accessing text form fields name=field[label] - comp.lang.javascript

Resources last updated: 3/12/2016 6:23:41 AM