Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
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 321 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 331 times

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]

Betvisa clone scripts are pre-built software solut[…]

A Bet365 Clone Script is essentially a ready-made […]