Copy link to clipboard
Copied
How to write default value(default text) in text field in indesign(not in pdf)? and how to get it?
Copy link to clipboard
Copied
How to write default value(default text) in text field in indesign(not in pdf)? and how to get it?
Copy link to clipboard
Copied
I have no clue what you are saying.
Please elaborate and show screenshots if you want us to help you.
jonathan
[moderator]
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
Sir,its not a normal textbox....my Question was about textfield(FormField related question)
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
FWIW: If that typed in text is working as default with an exported interactive PDF is a different question.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
Hi Madhuri1,
sorry. As I already said, I cannot give advice on SDK programming.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
okay Sir,
thank you