Re: SQL/4GL INPUT from a form
Posted in 1997
Jonathan Leffler wrote: > > On 20 Nov 1997, Glen Johnson wrote: > } How can I use place the screen cursor in a field at a locaiton other > } than the beginning of the field? > } > } For example I am requesting a US phone number. So the field is 9 digits > } long. If I already know the area code, I display it in the field and then > } perform an INPUT for the number. In these cases I would like the screen > } cursor to appear in the fourth position instead of the first. > > Succinctly, you can't. > > Or, at least, I don't know of any way to do it reliably. At least not the way that you have built the form. Change the phone number field to two or three 'formonly' fields, one each for area code, and phone number or exchange and number. Lets assume on only 2 fields, areacode and number in a local record named temprec: Then in the BEFORE FIELD areacode clause: IF length(myrec.phone[1,3]) > 0 THEN NEXT FIELD exchange -- or NEXT FIELD number END IF In the AFTER FIELD areacode clause: IF length(temprec.areacode) > 0 THEN LET myrec.phone = temprec.area_code, myrec.phone[4,9] END IF And similarly in the AFTER FIELD number clause: IF length(temprec.number) > 0 THEN LET myrec.phone = myrec.phone[1,3], temprec.number END IF Personally I like three separate fields, at least at the form level, it lets you display the number as the user is used to seeing it. Art S. Kagel