Combo new value after post back

I have a form with a number of combos created with dhtmlXComboFromSelect.

The form posts back to the server and if there are errors re-loads the form with populated values entered.

However I am struggling as to how to handle the case where a new value has been entered and getting the field correctly populated with the previously entered value AND setting the FIELD_new_value to TRUE.

I can hack it by adding the new value as an option to end of the generated select, but that doesn’t resolve the FIELD_new_value issue. I can use javascript to set that to TRUE, but then the issue is if that field gets focus and then blurs FIELD_new_value will be reset to FALSE as it’s recognised the current value is an ‘original’ value.

So my solution doesn’t really work and feels really hacky. I’m sure there must be a better solution to it, is there?

Hi

Could you please provide us complete demo including all correspondnig js/css files?
Please also add information regarding current and expected behaviour.

Here is a small guide how to make a complete demo:
docs.dhtmlx.com/tutorials__auxil … pport.html

If you don’t want to share your demo here for any reasons - you can send it to support@dhtmlx.com, if so - please include link to this forum topic.

If you’re using PRO Edition please send your demo to support@dhtmlx.com

Demo up here: stagingnest.com/dhtmlx_demo/

Download source from here: stagingnest.com/dhtmlx_demo/dhtmlx.zip .

There’s a small amount of PHP in there to mark the previously selected value as selected.

The form just posts back to itself. If a existing option is chosen from the list it can be shown as selected after the post back. If a new value is entered then this cannot be shown in the select list.

Thanks,

John

Hi

If a new value is entered then this cannot be shown in the select list.

in your demo combo actually represent select and do not about what was before page reload. you can update your code a bit:

index.php, before input type=submit:

<?php if (@$_REQUEST["myCombo_new_value"] == "true") { echo '<input type="hidden" id="custom_value" value="'.@$_REQUEST["myCombo"].'">'; } ?>

scripts.js, after combo init:

var i = $("#custom_value"); if (i[0] != null) myCombo.setComboText(i[0].value);