Readonly fields not updating

Hello,

I am using jscalendar to allow the user to select a date and populating
a readonly text field with the value. When I update the record the
value does not persist. If I change the text field to editable the
value saves fine. I am using the jscalendar to update the field the
same way in both instances.

Is there clean way to force the update?

Thanks,
Dan

Dan M. wrote:

Hello,

I am using jscalendar to allow the user to select a date and populating
a readonly text field with the value. When I update the record the
value does not persist. If I change the text field to editable the
value saves fine. I am using the jscalendar to update the field the
same way in both instances.

Is there clean way to force the update?

Thanks,
Dan

Unfortunately, this is just the way the web works - the values in
readonly fields in a form are not passed to server (PHP, ASP all work
the same way, to my knowledge).

The easy way around it is to make the field a hidden text field, and add
an additional ‘dummy’ readonly text field to display the value to your
user. Your javascript should set the value of both fields when the user
selects a date. The readonly field is just for show, and won’t pass in
the form submit, but the hidden field will.

c.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs