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

TOPIC:

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

  • liubov
  • liubov's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
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.

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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 following user(s) said Thank You: liubov

Please Log in or Create an account to join the conversation.

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

  • liubov
  • liubov's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
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

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

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.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Time to create page: 0.068 seconds

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started