Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: [ADDED] Change Model Rules (duplicate)

Change Model Rules (duplicate) 21 May 2016 11:17 #13999

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
  • Karma: 22
I am not sur to anderstand,

In my table, the 2 concerned fields (id_race, fname) are checked as 'Required', normal, it's a Key.

The generated xml is :
		<field name="id_race"
				alias="_id_race_value"
				label="JBREEDING_FIELD_RACES"
				filter="INT"
				listKey="id"
				labelKey="value"
				type="ckcombo"
				nullLabel="JBREEDING_JSEARCH_SELECT_RACES"
				required="true"
				class="validate[required]">
			<unique alias="fname_id_race" fields="fname,id_race"/>
		</field>

		<field name="fname"
				alias="fname"
				label="JBREEDING_FIELD_NOM"
				filter="STRING"
				type="cktext"
				required="true"
				class="validate[required]">
			<unique alias="fname_id_race" fields="fname,id_race"/>
		</field>

so class is "validate[required]", not "Default" ...

You can test with my project,
P -> JBreeding3.5
T-> Etalons
L-> Admin (Gestion des Etalons)

Choose 'Siberian Husky' and try to save New dog named 'CHIEN1' (already exits) ...
You get the SQL error and not the Duplicate Warning.
The administrator has disabled public write access.

Change Model Rules (duplicate) 21 May 2016 11:19 #14000

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
That's what I tought....

<field name="id_race"
		alias="_id_race_value"
		label="JBREEDING_FIELD_RACES"
		filter="INT"
		listKey="id"
		labelKey="value"
		type="ckcombo"
		nullLabel="JBREEDING_JSEARCH_SELECT_RACES"
		required="true"
		
		
//HERE
validate="default"		
		
		
		class="validate[required]">
	<unique alias="fname_id_race" fields="fname,id_race"/>
</field>

<field name="fname"
		alias="fname"
		label="JBREEDING_FIELD_NOM"
		filter="STRING"
		type="cktext"
		required="true"
		
		
//HERE
validate="default"		
		
		
		
		class="validate[required]">
	<unique alias="fname_id_race" fields="fname,id_race"/>
</field>
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: liubov

Change Model Rules (duplicate) 21 May 2016 14:37 #14002

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
  • Karma: 22
YOU ARE THE BEST !

Now, the test works fine, exactly how it is supposed to do.

No SQL err and the message is clear.


Thank you again for your great Support about that, very usefull for me and my Component Datas.

Marc
The administrator has disabled public write access.

Change Model Rules (duplicate) 25 May 2016 11:56 #14010

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Now it is properly finished since version 2.8.3
www.j-cook.pro/index.php/docs/versions/216-2-8-3
Coding is now a piece of cake
The administrator has disabled public write access.

Change Model Rules (duplicate) 12 Jun 2016 07:40 #14034

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
Hi admin,

You should also try to enforce the index limit of 1000 bytes. Installation will fail, but I do not think a lot of users will be able to pinpoint that to their index.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.066 seconds

Get Started