0

I am using jQuery in Salesforce for a requirement where I could have Calendar (with drag & drop). When I click on a particular date, I get a pop-up, wherein I select couple of drop downs values, couple of text fields and save that record into an object. Now when I'm updating that record, I'm not getting the drop down values being displayed. However if I change the drop down to an input field, then the values are getting displayed.

var titleField = $dialogContent.find("select[name='title']").val(calEvent.title);
var doctorField = $dialogContent.find("input[id='doctorId']").val(calEvent.doctorId);

1st one is for drop-down and the 2nd one is for text field. The values get displayed when using the later one and not in the former one.

Please help me in this regard.

1
  • I've updated the tags assuming you're doing this on a visualforce page. Please do try to select relevant and specific tags for your questions. The salesforce-crm tag should not be used as general tag because you don't know what to put there. Jan 21, 2014 at 12:30

1 Answer 1

1

Are you trying to get the value from the drop-down, or set the value? Because, from what I see from your code, you are using .val(value) which is a setter method, rather than .val() which is a getter method.

I.e.

// Gets the value from the selected option in the <select name="title"> element
var titleField = $dialogContent.find("select[name='title']").val();


// Sets the selected option in the <select name="title"> element
var doctorId = '00Ab00000057v4B';
$dialogContent.find("select[name='title']").val(doctorId);
1
  • Hi, I've got another situation of similar kind wherein there are 3 picklists (A,B & C) where B is dependent on A and C is dependent on B. The values for A are shown statically while B & C are obtained dynamically. So, when I open a record for editing, the values in B & C just show for 2-3 seconds and disappear. And I have used rendered here in order to get the list values of "B & C" picklists. Is there a way to display the selected values in these pciklists.
    – Sapthagiri
    Jan 27, 2014 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.