WPCubed Product Support

Move to the end of a form field

Hi,

I added a field with WPRichText.InputEditField('CAMPO','');

When I open the form, I use WPRichText.MoveToNextField(True);

So the first field is selected, but the cursor is on the beggining of the field, like <<|Rua >>, how do I move the cursor to the end of the field (<<Rua |>>), so I can continue typing after the default content?

Thanks!

#1 ♥ 0
7.1k Views 2 users read 2 min
support

You can use CPMoveNext until you hit CPChar=#3 - that would be the field closing.

Or you read the current field -FieldAtCP- and use TextCursor.MoveTo( field.EndTag )

#2 ♥ 0

@wpsupport:
You can use CPMoveNext until you hit CPChar=#3 - that would be the field closing.

Or you read the current field -FieldAtCP- and use TextCursor.MoveTo( field.EndTag )

But I have many fields on the form, and I navigate throught them using tab, and every tab I want the cursor to be on the end of the field, because every field have some default value I will use or change as needed.

Can you give a sample code on how to achieve that?

Also my WPTools_6_Reference is not showing any content, it shows the index but not any content..I just moved to a new PC with windows10, what can I do?

Thanks!

#3 ♥ 0

Ok I found a way to achieve that using

WPRichText.TextCursor.MoveTo(WPRichText.FieldAtCP().EndTag);

But I still can't figure out where to use this code to make it happen on every field change..

I tried OnEditFieldFocus but it doesnt work.

Also, I assumed that to move the cursor to the start of the field should be

WPRichText.TextCursor.MoveTo(WPRichText.FieldAtCP().StartTag);

but it doest do anything.

#4 ♥ 0
support

Sorry, I do not have a good answer here.

When the user moves the cursor the cursor should not be automatically relocated. When you use TAB to move to next field it is possible to put the code after the code which moves the cursor - trap the TAB key.

#5 ♥ 0
This category is archived. No new posts are possible.