depika
Joined: 22 May 2006
Posts: 5
Posted: 2006-05-29 17:05
Back to top
Reply with quote
|
I am getting the values in one field from another table. My problem is that when entering data the first record is selected. I want to have a null first value in the dropdown and since this field is required to have a popup message saying that this value cannot be null.
I have managed to set the first value to be null but on save the code seems to find that the field has value and is not null.
Below is my code
Code: |
$opts['fdd']['ISLAND'] = array(
'name' => 'ISLAND',
'select' => 'D',
'maxlen' => 50,
'sort' => true,
'required' => true
);
$opts['fdd']['ISLAND']['values']['table'] = 'ISLAND';
$opts['fdd']['ISLAND']['values']['column'] = 'ID';
$opts['fdd']['ISLAND']['values']['description'] ='ISLAND_EL' ;
$opts['fdd']['ISLAND']['values2'] = array('' => NULL);
|
I would appreciate your help
|
mushroom
Joined: 14 May 2006
Posts: 8
Posted: 2006-05-31 17:23
Back to top
Reply with quote
|
Hm... I think you need to use
Code: |
$opts['fdd']['col_name']['js']['required'] = true; |
or try regular expression to make your validation more powerful.
Example:
Code: |
$opts['fdd']['col_name']['js']['regexp'] = '/^[0-9]*$/'; |
Read
this
|
depika
Joined: 22 May 2006
Posts: 5
Posted: 2006-05-31 20:01
Back to top
Reply with quote
|
I added what you mentioned but still this field is not required if nothing gets selected. Does it matter that the field is a dropdown that the code doesn't work?
Is there a way to use the selected option of a dropdown?
Despoina
|
mushroom
Joined: 14 May 2006
Posts: 8
Posted: 2006-06-01 20:39
Back to top
Reply with quote
|
depika wrote: |
I added what you mentioned but still this field is not required if nothing gets selected. Does it matter that the field is a dropdown that the code doesn't work?
Is there a way to use the selected option of a dropdown?
Despoina |
So, when I asked your first post, I didn't test anywhere. And when you said, that ['js']['required'] and ['js']['regexp'] hadn't work, I decided to create simply example. So result was "fine" very much.
When you set validation for a dropdown PME create js-code.
For example:
Code: |
function PME_js_form_control(theForm)
{
if (theForm.PME_data_title.selectedIndex == -1) {
alert("Please enter TITLE.");
theForm.PME_data_title.focus();
return false;
}
return true;
} |
But... Where are my js-required and regexp validations?! PME only checks the number of the selected option. It must be >=0. But if you set validation for the text field all's right. So... PME doesn't allow regexp and empty-value validation for a dropdown. I think that it's logical, isn't it? Are you sure that you really need it?
|
paolodp
Joined: 06 Jul 2006
Posts: 11
Posted: 2006-08-03 07:21
Back to top
Reply with quote
|
hi mushroom,
I have read this post several times and, sorry, I dont understand it. So, please,
1) may you explain me how to set default of a dropdown to '' when it is populated from a mysql table (without adding the value '' in the table ) ?
2) if ...['js']['required']=true is used, it validates correctly ?
TY very much for help
|
mushroom
Joined: 14 May 2006
Posts: 8
Posted: 2006-08-14 09:56
Back to top
Reply with quote
|
paolodp wrote: |
1) may you explain me how to set default of a dropdown to '' when it is populated from a mysql table (without adding the value '' in the table ) ? |
If there are not '' in the dropdown you can't set it default.
paolodp wrote: |
2) if ...['js']['required']=true is used, it validates correctly ? |
No, it doesn't. PME generates it's own validation code for dropdowns. You may set ['js']['required']=true and look at the results.
Sorry, if my english so bad... =)
|
marty
Joined: 10 Jul 2006
Posts: 2
Posted: 2006-09-07 21:41
Back to top
Reply with quote
|
Firstofall, i think you do not use the "values2"-Option correctly: instead of
Code: |
$opts['fdd']['ISLAND']['values2'] = array('' => NULL); |
it should be
Code: |
$opts['fdd']['ISLAND']['values2'] = array(NULL => ''); |
if you want NULL in the DB, as the documentation says
Quote: |
...that array keys will be stored into database and array values will be printed out in input section boxes... |
But also then it won't work correctly, because the PHPMyEdit-Class function do_change_record() generates a (what I think is not correct) query of the form
Code: |
UPDATE... SET field='NULL' |
which sets the field to numeric 0 -
the query should be
Code: |
UPDATE... SET field=NULL |
(I'm surprised how tolerant MySQL is, because all fields in the generated Query are quoted)
So, as a workaround, if your field doesn't has to be NULL and 0 is enough, then take
Code: |
$opts['fdd']['ISLAND']['values2'] = array(0 => ''); |
and it should work.
Hope that helps,
Martin
|
michal
Joined: 17 Jun 2003
Posts: 537
Location: Slovakia
Posted: 2006-09-08 14:42
Back to top
Reply with quote
|
just use trigger before with single line like:
if($newvals['key']==0) unset($newvals['key']);
|
sagiben
Joined: 27 Jan 2009
Posts: 15
Posted: 2009-07-25 16:41
Back to top
Reply with quote
|
I'm having the same problem,
I still don't know how to solve it but I guess there's a bug in PME because selectedIndex can never be -1 and thus
the 'if' statement will always fail.
|
jones123
Joined: 27 May 2019
Posts: 6
Posted: 2019-05-27 16:05
Back to top
Reply with quote
|
The company was purchased by Intel in February 2011 and became part of the Intel Security successfully.
norton.com/setup
|
McAfee.com/activate
|
office.com/setup
|
jones123
Joined: 27 May 2019
Posts: 6
Posted: 2019-05-27 16:06
Back to top
Reply with quote
|
Norton is till date one of the finest products related to the security setup of your computer system.
office.com/setup
|
norton.com/setup
|
norton.com/setup
|
norton.com/setup
|
richard1220
Joined: 05 Jul 2019
Posts: 6
Posted: 2019-09-24 15:16
Back to top
Reply with quote
|
Business users may choose the product according to their business level. Other product by the antivirus is for different categories and users across the world rely on it to secure their data. http://assist-norton.com/setup
https://bookmcafee.com/activate/
|
lucifer1413
Joined: 02 Jan 2020
Posts: 23
Posted: 2020-03-06 07:54
Back to top
Reply with quote
|
Microsoft_Office
also known as Office is a family of premium customer software manufactured and distributed by Microsoft. Office proves its worth by offering over 100 languages compatibility and extensively used apps like Outlook, Excel, Word, and PowerPoint. Every working individual or student can benefit from MS Office as it fulfils the ever diverse client demands. You can get the premium Office applications by downloading, installing, and activating it on
office.com/setup
.
|
daftarpokerqq
Joined: 10 Apr 2020
Posts: 1
Posted: 2020-04-10 10:14
Back to top
Reply with quote
|
DaftarpokerQQ
|
pasarbola
Joined: 10 Apr 2020
Posts: 2
Posted: 2020-04-10 18:27
Back to top
Reply with quote
|
Setiap permainan online yang
tembak ikan
ada pada pasarbola memiliki minimal bet taruhan tersendiri
|
Post new topic
Reply to topic
Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9 Next
|