Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Indesign Buttons and Forms

Explorer ,
Sep 11, 2020 Sep 11, 2020

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

TOPICS
SDK
893
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 11, 2020 Sep 11, 2020

I have no clue what you are saying. 

 

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

 

jonathan

[moderator]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 13, 2020 Sep 13, 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.Screenshot 2020-09-14 at 10.25.18 AM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2020 Sep 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!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2020 Sep 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 )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 16, 2020 Sep 16, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2020 Sep 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 )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 16, 2020 Sep 16, 2020

okay sir,thank you

also I want this text using present functions in indesign sdk,means

for example I got formfield name using following code :

( pageItemUIDRef - UIDRef of that shape)

 InterfacePtr<IGraphicStyleDescriptor>descriptor (pageItemUIDRef,UseDefaultIID());

PMString field_name = Utils<IAttributesUtils>()->GetStringValue(descriptor,  kFormNameAttrBoss);

likewise I want that deafult text...

 

I was tried this way PMString field_val = Utils<IAttributesUtils>()->GetStringValue(descriptor, kFormValueAttrBoss);

but it does'nt work.

I used IGraphicStyleDescriptor, IAttributesUtils.h and FormFieldId.h files from indesign sdk.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2020 Sep 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 )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2020 Sep 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 )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2020 Sep 16, 2020

Hi Madhuri1,

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

 

Regards,
Uwe Laubender

( ACP )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 16, 2020 Sep 16, 2020

okay Sir,

thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Sep 16, 2020 Sep 16, 2020
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines