Skip to main content
Inspiring
September 11, 2020
Question

Indesign Buttons and Forms

  • September 11, 2020
  • 6 replies
  • 969 views

How to write default value(default text) in text field in indesign(not in pdf)? and how to get it?

This topic has been closed for replies.

6 replies

Legend
September 16, 2020

With all the forums mixed together it was not clear that you indeed meant C++ plug-in.

So you have somehow created and got a hold on a kTextFieldItemBoss. Following thru IID_IHIERARCHY children you get to the kSplineItemBoss, then kMultiColumnItemBoss which has a IID_IMULTICOLUMNTEXTFRAME leading to the kTextStoryBoss.

There you'd access text like with any text story.

Community Expert
September 16, 2020

Hi Madhuri1,

sorry. As I already said, I cannot give advice on SDK programming.

 

Regards,
Uwe Laubender

( ACP )

Madhuri1Author
Inspiring
September 16, 2020

okay Sir,

thank you

Community Expert
September 15, 2020

The title of your question also mentions buttons

 

With buttons it's still a bit different. The state of a button could simply contain nearly "everything". A text frame, a graphic frame, a group of things etc.pp. So in case of a button you have to go through its state objects followed by a group object that contains everything in that state.

 

 

myButton.states[0].groups[0].allPageItems;
// Loop that array to find a text frame or a text paths
// to get the text that is contained by the first state.

 

 

Regards,
Uwe Laubender

( ACP )

Community Expert
September 15, 2020

FWIW: If that typed in text is working as default with an exported interactive PDF is a different question.

 

Regards,
Uwe Laubender

( ACP )

Community Expert
September 15, 2020

Hi Madhri1,

you tagged your question with the "SDK" label.

Sorry, but I can only tell how this is working in the scripting DOM with ExtendScript.

 

The object textBox has no texts or parentStory property.

So you cannot get directly to your typed text.

 

Instead, textBox has properties like pageItem or even textFrame.

So get your text this way:

myTextBox.textFrames[0].texts[0]

 Or this way:

myTextBox.pageItems[0].getElements()[0].texts[0]

 

Regards,
Uwe Laubender

( ACP )

Madhuri1Author
Inspiring
September 16, 2020

Sir,its not a normal textbox....my Question was about textfield(FormField related question)

Community Expert
September 16, 2020

Hi Madhuri1,

the variable "myTextBox" in my code snippet stands for an InDesign textBox object which is indeed a form field.

You must not confuse the textBox object with a textFrame object.

 

What my code is showing:

The textBox object contains a textFrame object.

And that text frame contains your formatted text which is texts[0].

( All that said in ExtendScript scripting terms. )

 

Regards,
Uwe Laubender

( ACP )

JonathanArias
Legend
September 11, 2020

I have no clue what you are saying. 

 

Please elaborate and show screenshots if you want us to help you.

 

jonathan

[moderator]

Madhuri1Author
Inspiring
September 14, 2020

Hello Sir,

           I Want to Know how to write some default text in textfield (while writing  in Form field)in indesign.I tried for this in this way(following screenshot shows this). But while reading in indesign (from indesign sdk functions). I did'nt get it.

Colin Flashman
Community Expert
Community Expert
September 14, 2020

I don't think you can with scripting, certainly cannot do this without scripting.

 

I've had a look at the textbox object model and there doesn't seem to be a property for default text. https://www.indesignjs.de/extendscriptAPI/indesign-latest/#TextBox.html#d1e160232

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!