Page 1 of 1

Default value when using metadata xml forms.

Posted: Thu May 31, 2018 12:48 am
by cherifmad
Good morning,
I have a problem.
I would like to know if it is possible to add a default value when we create an Xml metadata form.
for example :

Code: Select all

<property groups>>property groups
  property group label="Consulting" name="okg:consulting">"okg:consulting".
    <input label="Name" type="text" name="okp:consulting.name "value=" default name"/>" name"/>".
    <input label="Date" type="date" name="okp:consulting.date" value ="default text"/>>default text".
    <checkbox label="Important" name="okp:consulting.important"/>>".
    <textarea label="Comment" name="okp:consulting.comment" value=" textarea by default" />>"okp:consulting.comment" value=" textarea by default".
    <input label="Input label" name="okp:consulting.input1" />"Input label" name="okp:consulting.input1" />
    <separator label="Separator label" name="okp:consulting.separator" />"okp:consulting.separator" /> 
    <input label="Input label" name="okp:consulting.input2" />"Input label="Entrée label" name="okp:consulting.input2" />

    
  </group of goods>>group of goods
I'm trying but there's an error on my screen:

Application error
Class: com.openkm.core.ParseException
Message: Attribute "value" must be declared for element type "input".
Date: Thu May 31 00:46:12 UTC 2018

can you help to resolve it.
thanks for all

Re: Default value when using metadata xml forms.

Posted: Thu May 31, 2018 3:27 pm
by lnovoa
Hi!,
The xml was not well formed, if it is as you show in the post.
Try this example and you will see the default values.

https://docs.openkm.com/kcenter/view/ok ... field.html

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.9//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.9.dtd">
<property-groups> 
  <property-group label="Consulting" name="okg:consulting">
    <input label="Name" type="text" name="okp:consulting.name" value="default value"/>
      <input label="Date" type="date" name="okp:consulting.name" value="20100611221912"/>
       <checkbox label="Important" name="okp:consulting.important"/>
    <textarea label="Comment" name="okp:consulting.comment" value="textarea by default" />
    <input label="Input label" name="okp:consulting.input1"  value="default value" />
    <separator label="Separator label" name="okp:consulting.separator" />
    <input label="Input label" name="okp:consulting.input2" value="default value" />
        </property-group>
</property-groups>

Re: Default value when using metadata xml forms.

Posted: Thu May 31, 2018 4:11 pm
by cherifmad
lnovoa wrote:
Thu May 31, 2018 3:27 pm
Hi!,
The xml was not well formed, if it is as you show in the post.
Try this example and you will see the default values.

https://docs.openkm.com/kcenter/view/ok ... field.html

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.9//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.9.dtd">
<property-groups> 
  <property-group label="Consulting" name="okg:consulting">
    <input label="Name" type="text" name="okp:consulting.name" value="default value"/>
      <input label="Date" type="date" name="okp:consulting.name" value="20100611221912"/>
       <checkbox label="Important" name="okp:consulting.important"/>
    <textarea label="Comment" name="okp:consulting.comment" value="textarea by default" />
    <input label="Input label" name="okp:consulting.input1"  value="default value" />
    <separator label="Separator label" name="okp:consulting.separator" />
    <input label="Input label" name="okp:consulting.input2" value="default value" />
        </property-group>
</property-groups>
Thanks Dear Inovoa, I have try it ( your script) But this error appear ...
how can I resolve and fix this problem

Re: Default value when using metadata xml forms.

Posted: Fri Jun 01, 2018 8:09 am
by lnovoa
Hi,
In this link, you can see how it is built and then you simply have to add
the value properties and the date format mentioned in the previous post

https://docs.openkm.com/kcenter/view/ok ... ition.html

Re: Default value when using metadata xml forms.

Posted: Fri Jun 01, 2018 9:37 am
by cherifmad
lnovoa wrote:
Fri Jun 01, 2018 8:09 am
Hi,
In this link, you can see how it is built and then you simply have to add
the value properties and the date format mentioned in the previous post

https://docs.openkm.com/kcenter/view/ok ... ition.html
I saw this link again, I set the default value, but the same error persists.
Please, can you write a script that works very well in your openKM and I will test at home to see where I make my mistakes?
thank you for your understanding

Re: Default value when using metadata xml forms.

Posted: Fri Jun 01, 2018 11:23 am
by lnovoa
Hi!,

for example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.7//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.7.dtd">
<property-groups> 
  <property-group label="Consulting" name="okg:consulting">
    <checkbox label="Important" name="okp:consulting.important"/>
    <textarea label="Comment" name="okp:consulting.comment" value="textarea by default" />
    <input label="Input label" name="okp:consulting.input1"  value="default value" />
    <separator label="Separator label" name="okp:consulting.separator" />
    <input label="Input label" name="okp:consulting.input2" value="default value" />
    <input label="Date" type="date" name="okp:consulting.name" value="20100611221912"/>
   </property-group>
</property-groups>

Re: Default value when using metadata xml forms.

Posted: Sat Jun 02, 2018 1:07 am
by cherifmad
lnovoa wrote:
Fri Jun 01, 2018 11:23 am
Hi!,

for example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.7//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.7.dtd">
<property-groups> 
  <property-group label="Consulting" name="okg:consulting">
    <checkbox label="Important" name="okp:consulting.important"/>
    <textarea label="Comment" name="okp:consulting.comment" value="textarea by default" />
    <input label="Input label" name="okp:consulting.input1"  value="default value" />
    <separator label="Separator label" name="okp:consulting.separator" />
    <input label="Input label" name="okp:consulting.input2" value="default value" />
    <input label="Date" type="date" name="okp:consulting.name" value="20100611221912"/>
   </property-group>
</property-groups>
Sorry, I have executed your Script but an over error appear ... See the screenshot
Thanks for your understanding

Re: Default value when using metadata xml forms.

Posted: Sat Jun 02, 2018 4:35 pm
by jllort
Community DTD latest version is 2.3 not 2.7 as you can see here https://docs.openkm.com/kcenter/view/ok ... table.html

Try with:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.3//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.3.dtd">
<property-groups>
  <property-group label="Consulting" name="okg:consulting">
    <input label="Input label"  name="okp:consulting.input" value="test" />
  </property-group>
</property-groups>