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

Alt+down arrow pressed javascript

Participant ,
Jan 20, 2016 Jan 20, 2016

How would I input a javascript for onFocus that says the alt key and down arrow are pressed (even though they arent)?

event.altKey==true

I know that is how you get the alt key to say it is pressed, but how do you do the down arrow with it (combination)?

The Keycode for the down arrow is 40 but I don't know how to link it to the alt key saying both are pressed even when they arent.

Any help would be amazing. Thanks.

TOPICS
Acrobat SDK and JavaScript
3.1K
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

correct answers 1 Correct answer

Community Expert , Jan 20, 2016 Jan 20, 2016

You should use a separate field (a text field) that you can display when Other is selected for the user to fill in additional information.

Translate
Participant ,
Jan 20, 2016 Jan 20, 2016

Is this possible? I need this for a editable dropdown menu. GKaiseril try67 ??? All help is appreciated. Thanks

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 ,
Jan 20, 2016 Jan 20, 2016

I don't think it's possible. These kind of properties are typically

read-only.

On Wed, Jan 20, 2016 at 8:48 PM, Italian4215 <forums_noreply@adobe.com>

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
Participant ,
Jan 20, 2016 Jan 20, 2016

If that isn't possible then how would I make it so that if for example the word "Other" was selected from a drop down menu to make the drop down editable with the cursor in the field and a default of "Please enter your name" else it is just a regular dropdown and not editable?

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 ,
Jan 20, 2016 Jan 20, 2016

You should use a separate field (a text field) that you can display when Other is selected for the user to fill in additional information.

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
Participant ,
Jan 21, 2016 Jan 21, 2016

How would I code it so that I know "Other" is selected? Would I use .value? or is there something else I could use for dropdowns? Thanks

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 ,
Jan 21, 2016 Jan 21, 2016

Yes, use the value property. If you do it in the field's custom validation

event use event.value to access the newly selected item.

On Thu, Jan 21, 2016 at 3:10 PM, Italian4215 <forums_noreply@adobe.com>

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
Participant ,
Jan 21, 2016 Jan 21, 2016

Okay one more question, how do I make it set focus to the text field with text highlighted?

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 ,
Jan 21, 2016 Jan 21, 2016

Not possible.

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
Participant ,
Jan 21, 2016 Jan 21, 2016

Actually it is, I just did it.

if (this.getField('Sender_Name').value=="Other") {

      

this.getField('SName').value = "Please Enter Your Name";

this.getField("SName").display = display.visible;

this.getField('SName').setFocus();

    }

else{

this.getField('SName').value = this.getField('Sender_Name').value;

this.getField("SName").display = display.hidden;

}

Apparently if there is text in the text field and setFocus is set to that field, it automatically highlights the text.

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 ,
Jan 21, 2016 Jan 21, 2016

I had remembered it just sets the focus to the field. Didn't remember it also selects the text... Sorry about the misinformation.

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
Participant ,
Jan 21, 2016 Jan 21, 2016

With this current code it works; however, since the text field is set to .setFocus() when the value of the dropdown is "Other" it doesn't allow me to use the dropdown arrow once it focuses on the text field. Is there a way around this?

var Name = this.getField('Sender_Name');
var SN = this.getField('SName');

if (SN.value=="Other") {
      
Name.value = "Please Enter a Sender Name";
Name.display = display.visible;
Name.setFocus();
    }
else{
Name.value = SN.value;
Name.display = display.noView;
}

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 ,
Jan 21, 2016 Jan 21, 2016

Where did you place this code?

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
Participant ,
Jan 21, 2016 Jan 21, 2016

It's in the format code for the dropdown

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
Participant ,
Jan 21, 2016 Jan 21, 2016

I got it to work by changing the .setFocus() to .bringToFront()

Only issue is the default text isn't highlighted now. Is there a way I can get it to be highlighted (another words get the text to be selected)?

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
Participant ,
Jan 21, 2016 Jan 21, 2016
LATEST

Figured out an alternative. I put this bit of code in the onFocus - run javascript of the field:

if(event.target.value=="Please Enter a Sender Name"){

event.target.value ="";

}

This way when focus is brought to the field, that ghost text will you disapears and they can type what they want in the field.

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
LEGEND ,
Jan 20, 2016 Jan 20, 2016

I do not see a altKey property as a property for the event object. There is a keyDown property for use as part of the keystroke event for combo and list boxes. There is also the modifier property for any event.

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
Participant ,
Jan 21, 2016 Jan 21, 2016

Apparently the KeyDown function is not allowed when you have an editable dropdown. So I am going to do what Try67 mentioned above.

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