[Javascript] Form focus

George Pitcher george.pitcher at ingenta.com
Mon Jun 7 05:36:30 CDT 2004


Shawn,

Sorry about the spanner I threw into your 'Thousands separator' task last
week.

I finally got round to working with the earlier stuff you sent me and it was
fine but only worked when I was changing field contents. By changing
onchange to onfocus, I was able to have the same functuonality as I have in
Filemaker.

Thanks for setting me off in the right direction.

Cheers

George in Oxford

> -----Original Message-----
> From: javascript-bounces at LaTech.edu
> [mailto:javascript-bounces at LaTech.edu]On Behalf Of Shawn Milo
> Sent: 10 May 2004 2:29 pm
> To: [JavaScript List]
> Subject: Re: [Javascript] Form focus
>
>
> George,
>
> Welcome to the group.
>
> I'm not sure I completely understand what you're trying to do with the
> single fields.  I'm assuming that the second button will also submit the
> form, though.  If this is the case, then you can have Javascript in the
> onchange event of each textbox, which sets the value of an HTML object,
> type 'hidden'.  Something like this:
>
>       <form id="testForm" method="post" action="./action.php">
>          <input type="hidden" id="hiddenFieldID"
> name="hiddenFieldID" value="" />
>
>          <input type="text" id="field01" id="field01"
> onchange="document.forms['testForm'].hiddenFieldID.value =
> this.id;" value="" /><br/>
>          <input type="text" id="field02" id="field02"
> onchange="document.forms['testForm'].hiddenFieldID.value =
> this.id;" value="" /><br/>
>
>       </form>
>
>
> I didn't include a submit button here, and there is no handling
> for someone who edits
> more than one text box then tries to use your second button.  But
> I think the basics
> are here, and you can use the value of the hidden server-side to
> know which field
> to single out.
>
> I'm sure others will correct/enhance my suggestion if I'm doing
> this the hard way.
>
> Shawn
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list