XPages Question - how to set the value of an editable field

I’m wanting to populate some editable fields from a Response doc listed in a View Panel when the user clicks on a column. Setting a Computed field’s value is easy but I’m missing something when it comes to Editable fields.

Data Binding to the field, having set the Data Source using a sessionScope variable fails. getComponent().setValue fails. What other ways are there please?

See my Blog for more details and a picture…

http://www.bleedyellow.com/blogs/YellowNotes/entry/xpages_coding_question_editting_response_docs_within_parent_doc35

Any thoughts would be very welcome, please.

Thanks. Jerry.

Subject: Value property and a partial refresh

Have you tried setting the value to the editable field under:On Editable field - ‘all propeties>data>value’?

That’s what I use to populate my editable fields and I too am using some sessionscopes. Something to mention is that you will also most likely need to run a partial refresh AFTER setting the scoped variable (as it’s an editable field. You may or may not need to do this). So if you set the column on your view panel to refresh your editable field id under onclick or onchange that may do the trick.

Subject: Re: All Properties/Data/value

Thanks for replying Neemesh.

If the Editable field is bound, then it has a “value” such as

MIPSIngredientDoc.MIPIngredient

where MIPSIngredientDoc is the Data Source and MIPIngredient is a field name.

I’ve tried putting SSJS in to get the doc using the Scoped variable, and accessing the value from there all to no joy.

I’m at my wits end.

Subject: My mistake

Sorry made a mistake there, I meant ‘defaultvalue’ as opposed to ‘value’.

‘Value’ like you said should bind it to your datasource, ‘defaultvalue’ should allow you to set the sessionscope variable to the field, providing it gets refreshed in some way in the front end.

In my database, I’m navigating away from the xpage that sets the variable, to another page. Once the user has completed that page, they’re sent back again to the original page(which then refreshes the field for me with a default value from the sessionscope), so this works fine for me in my particular case. In your case as you’re not navigating away, so a partial refresh by id may be a nicer way of doing it for you and with any luck will bring the same results.

Hope it helps.

Subject: No joy

Thanks again Neemesh for your interest.

DefaultValue only seems to get set when you first open a page.

Partial Refresh is ideally what I want, but I’ve tried with Partial and Full refresh with no joy. Also I’ve switched on “No Validation” in the View Panel Column in order that the Validation on the mandatory fields is not triggered.

More thoughts welcomed.

Subject: Sussed it ! :frowning:

Switching “No data validation” on in the column has the show-stopping side-effect of not allowing any data to be generated in an editable field!

For a few minutes a day I love XPages, but for most of the time it’s things like this that make me hate them.

Does anyone have an opinion as to whether this is behaving as designed, please?