NetTalk Central

Author Topic: Set Focus for the a particular field in a webform  (Read 3566 times)

ralonso2001

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Qúbigo ERP
    • Email
Set Focus for the a particular field in a webform
« on: November 29, 2014, 08:06:25 AM »
Hi, I´m trying to set the focus on a control in a web form when it opens, but I cant make it work, it always strarts with focus on the first field but not the one I have set.
Where is the correct embed point to set the focus to a control?
Is "p_web.SetValue('SelectField',clip(loc:formname) & '.fieldname') the correct sentence?
Thank you!
« Last Edit: November 30, 2014, 02:34:56 PM by ralonso2001 »
Regards,
Rodrigo Alonso
Mendoza - Argentina

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Set Focus for the a particular field in a webform
« Reply #1 on: December 01, 2014, 05:48:19 AM »
Hi Rodrigo,

>> Is p_web.SetValue('SelectField',clip(loc:formname) & '.fieldname') the correct sentence?

yes. But be aware that the .FieldName part is case sensitive.

The problem is _when_ you do it, because the form "procedure" is an Event Handler, not a procedure.
I would probably do it in the preInsert or preUpdate routine, but I would use differnet code;

loc:retrying = true
p_web.SetValue('retryfield','fieldname')


Cheers
Bruce

ralonso2001

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Qúbigo ERP
    • Email
Re: Set Focus for the a particular field in a webform
« Reply #2 on: December 01, 2014, 08:17:36 AM »
Thank you Bruce!
When I place the code in the "PreInsert" embed point, it opens the form and gives me all the validation warnings of the required fields, I seems than when I put the value of true in the loc:retrying variable it performs validations in the form fields.
Any help will be great!!! My customer seems not to understand that this functionallity is not so symple...
Regards,
Rodrigo Alonso
Mendoza - Argentina