SELECT field Readonly on GridAdd

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Bishu
User
Posts: 429

SELECT field Readonly on GridAdd

Post by Bishu »

I have a filed with SELECT using lookup table.
On the GridAdd I want to make this field readonly where user can not change the value of this select.

I try using as on the Row_Rendering
$this->fieldname->ReadOnly = TRUE; // Using this the user can change the Select Value.
$this->fieldname->Disable = TRUE; // NULL value is inserted in the table.

I try again on the List Page -> Page_Render
$this->fieldname->Disable = TRUE; // NULL value is inserted in the table

How can I make a select field readonly on the GridAdd where user can not change the value but the display value should be inserted in the table.


mobhar
User
Posts: 11703

Post by mobhar »

If you want to obviously disable the field, then you need to handle the value by yourself based on your business-logic, either in "Row_Inserting" or "Row_Updating" server event.


Bishu
User
Posts: 429

Post by Bishu »

Or is there any option to make the GridAdd field to be TEXT field and the Search field to be SELECT Field.

for example. my field name is session.

In the search panel I want this session to be SELECT field.
But on the GridAdd Page I want this session to be TEXT field.


mobhar
User
Posts: 11703

Post by mobhar »

Currently, it is not supported.


jtandrea
User
Posts: 38

Post by jtandrea »

hi.
I recently came across the same problem.
I solved it this way:

in the Client Scripts section, Table-Specific, say Add/Copy Page, Startup Script:

$("#x_field1").click(function () {
$("#x_field1 option").not(':selected').each(function (index) {
$(this).prop('disabled', true);
});
});

with calendar, you could disable calendar button
just adding in the ewclandar.js, inside ew_CreateCalendar function:

// Create calendar
function ew_CreateCalendar(formid, id, format) {

right under code

    if ($el.parent().is(".input-group"))
            return;
    var $btn = $('<button type="button"><span class="glyphicon glyphicon-calendar"></span></button>')
            .addClass("btn btn-default btn-sm").css({ "font-size": $el.css("font-size"), "height": $el.outerHeight() })
            .click(function() { $(this).closest(".has-error").removeClass("has-error"); });

put >>>> $btn[0].disabled = ($el.is('[readonly]'));


jtandrea
User
Posts: 38

Post by jtandrea »

sorry, for List Page:

$(".form-control").mouseover(function () {
var id = $(this).attr("name");
if (id.value > 0) {
$("#" + id + " option").not(':selected').each(function (index) {
$(this).prop('disabled', true);
});
});
});


Post Reply