FoxInCloud
Move the VFP textbox.interactivechange () surface event from the server to the client
Gravatar is a globally recognized avatar based on your email address. Move the VFP textbox.interactivechange () surface event from the server to the client
  Gilles Lajot-Sarthou
  All
  Mar 10, 2021 @ 05:36am

Hi all,

I want to move the VFP textbox.interactivechange () surface event from the server to the client.

*!* TextBox object
*!* --------------
*!*PROCEDURE INIT
*!*	=THIS.ADDPROPERTY('champsaisi', .F.)
*!*	RETURN DODEFAULT()
*!*ENDPROC
PROCEDURE INTERACTIVECHANGE
	LPARAMETERS Useless_Parm

	IF (TYPE('m.THISFORM.wlHTMLgen') == 'L' AND m.THISFORM.wlHTMLgen = .T.)
		LOCAL lcJS AS STRING

		TEXT to lcJS textmerge noshow flags 1 pretext 7
    		var cmd = jQuery('#<<this.wcID>>');
    		cmd.prop('champsaisie', true);
		ENDTEXT
		RETURN m.lcJS
	ENDIF
	WITH m.THIS
		.champsaisi = .T.
	ENDWITH
ENDPROC

Is this code the correct one to move the processing to the server side in the client's browser ?

Cordialement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: Move the VFP textbox.interactivechange () surface event from the server to the client
  Vincent H.
  Gilles Lajot-Sarthou
  Mar 11, 2021 @ 01:59am

Hello Gilles,

I don't understand what you want to do but adding your property seems insufficient to me.
What exactly do you want to achieve ?

Bien à toi,
Vincent

Gravatar is a globally recognized avatar based on your email address. re: Move the VFP textbox.interactivechange () surface event from the server to the client
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 11, 2021 @ 07:23am

Hi Gilles,

2 remarks

  1. to store an information into an HTML element Object Model, rather than adding a custom property to the element itself, you'd now add a property to the 'data' collection, now a standard for such a custom extension: jQuery('selector').data('property', value)
  2. I understand that 'champsaisie' is a state property in your application; if you change it on client side, you should also change it on server side so that both are in sync. If you need this functionality in many places, we could maybe implement this method: awFrm.wStatePropSet() that would alter the same property on client and server, in the latter case by shunting (short-circuiting) the full state management process (restore, save, compare, … etc.).

Gravatar is a globally recognized avatar based on your email address. re: Move the VFP textbox.interactivechange () surface event from the server to the client
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 11, 2021 @ 11:50pm

Hi Thierry, In desktop mode, I use in the textbox, editbox, etc. objects the boolean champaisi property (and another string property champwhen). They are used to identify if there has been a keystroke of a text. This property is tested in the valid () event to trigger or not an action. This makes it possible to distinguish after typing on the 'enter' or 'tabulation' keys whether or not there has been a modification of the content of the input field. On the events:

  • object.gotfocus () champaisi = .F.
  • object.when () champwhen = object.value
  • object.interactivechange champaisi = .T. Without the object.valid () event
IF m.THIS.champsaisi = .T. AND m.THIS.VALUE <> m.THIS.CHAMPWHEN
   * here entry validation processing
ENDIF

In WEB mode I would like that champwhen and champaisi are only known and processed on the client side and on the client side that a 'blur' is sent to the server only if champaisi = .T. and value <> champwhen If there's another way, I'm a taker

Amicalement Gilles

Gravatar is a globally recognized avatar based on your email address. re: Move the VFP textbox.interactivechange () surface event from the server to the client
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 12, 2021 @ 09:08am

As a standard behavior, in FoxinCloud.js, for <input> and <textarea>:

  • FoxinCloud.inputsSetup() sets a handler on .focus() that stores .value in .valueOld
  • FoxinCloud.EventRequest() send the .blur() event to the server only if .value !== .valueOld, except if you set in xxx.js: FoxinCloud.inputAlwaysBlur = true or FoxinCloud.inputAlwaysBlurOnReturn = true and user has hit the Enter key.

Playing with FoxinCloud.inputAlwaysBlur and/or FoxinCloud.inputAlwaysBlurOnReturn may address your issue.

In this case you would set in xxx*.init(): this.champSaisie = type('thisForm.wlWeb') == 'L' and thisForm.wlWeb

Gravatar is a globally recognized avatar based on your email address. re: Move the VFP textbox.interactivechange () surface event from the server to the client
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 12, 2021 @ 09:12am

Merci Thierry.. Amicalement Gilles

© 1996-2024