Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#790435
Hi

I has a suggest that i want change value it
Code: Select all
$("#SetValue").click(function(){
	$("#User").setValue($("#USR_UID").getValue());
})
But setValue function change value and text suggest!
also setText function change value and text suggest!

how can change only value or only text of suggest?
(2.83 KiB) Downloaded 116 times
#790446
There is currently a bug in suggest boxes. You can set the value with setValue(), but it doesn't select one of the options.

I have created two workaround functions that you should use in place of setValue() and setText() with suggest boxes:
Code: Select all
//function to use in place of setText() with suggest boxes:
// if the ID of the suggest box is "selectUser" and its SQL query is: 
// SELECT USR_UID, USR_USERNAME FROM USERS
// then: selectOptionText('selectUser', 'admin');
function selectOptionText(suggestId, optionText) {
  var aOptions = getFieldById(suggestId).executeQuery();

  for (var i in aOptions) {
    if (aOptions[i].text.search(optionText) != -1) {
      $("[id='form["+suggestId+"_label]']").val( aOptions[i].text );
      $("[id='form["+suggestId+"]']").val( aOptions[i].value );
      return;
    }
  }
  //no match found in list of options so use setText():
  $("#"+suggestId).setText(optionText);
}

//function to use in place of setValue() with suggest boxes:
// if the ID of the suggest box is "selectUser" and its SQL query is: 
// SELECT USR_UID, USR_USERNAME FROM USERS
// then: selectOptionValue("selectUser", "00000000000000000000000000000001");
function selectOptionValue(suggestId, optionValue) {
  var aOptions = getFieldById(suggestId).executeQuery();

  for (var i in aOptions) {
    if (aOptions[i].value.search(optionValue) != -1) {
      $("[id='form["+suggestId+"_label]']").val( aOptions[i].text );
      $("[id='form["+suggestId+"]']").val( aOptions[i].value );
      break;
    }
  }
  //no match found in list of options so use setValue():
  $("#"+suggestId).setValue(optionValue);
}
Here is a sample DynaForm to demonstrate its use:
(2.7 KiB) Downloaded 127 times

Hi, What version of the program are you using? […]

HI Programerboy, Thank you for your advice. I am[…]

Adding CurrentDate to Case Label

Hi, Please check the following link: http://pmlea[…]

How to categories inbox cases

I dont quite know the answer to you question, but […]