Adding image url in data array in template

29 views
Skip to first unread message

Lakshmanan Subbiah

unread,
Feb 1, 2017, 11:35:23 AM2/1/17
to Collection+JSON
Hi,
I have an API to render a Form ( which is a public form ) so I need to include a captcha Image along with the template object in the collection + JSON format. My doubt is whether the data array present within the template object can have custom values. I generally have this doubt not specific to this case because the forms have to be constructed based on some additional information apart from name value and prompt


Thanks & Regards
Lakshmanan

mca

unread,
Feb 1, 2017, 12:20:35 PM2/1/17
to collect...@googlegroups.com
interesting idea.

can you show an example of what you are thinking about representing in Cj messages?

--
You received this message because you are subscribed to the Google Groups "Collection+JSON" group.
To unsubscribe from this group and stop receiving emails from it, send an email to collectionjson+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lakshmanan Subbiah

unread,
Feb 1, 2017, 11:20:44 PM2/1/17
to Collection+JSON
Yup,
    Let me assume a form that is purely constructed by the server in collection+json. This will need me to give more data regarding the form, for example, a form may contain an image in between as captcha (as in my case) or may be the class name for styles need to be given from server and other properties like
  1. length
  2. whether mandatory field or not 
  3. type of the field ( regex)
  4. whether the field is read only etc.
    This may come as many as there are constraints in forms specific to use case. In some cases, the forms may have more than one buttons and actions related to that buttons. This will be tough with the current format. The javascript validation of forms differ from form to form and for a pure hyper client  IMHO, the javascript must be not so specific about each form if that is the case it must come from the server. 


My Idea regarding representation for this problem can be generalising the custom keys in the data array.
templates :{
      data :[
                 {
                     name:sampleData1,
                     value:"",
                     prompt:sampleData1,
                     customData or customFields (suitableKey) :{
                                                                                              length:23,
                                                                                             isMandatory : true

                                                    }
                 }
          ]

}

Thanks & Regards
Lakshmanan

mca

unread,
Feb 1, 2017, 11:30:45 PM2/1/17
to collect...@googlegroups.com
check out the following registered Cj extensions:

the first covers your isMandatory and regexp.
the second applies read-only to the item, but offers an example of how to apply the same property to a data element

length seems like a useful addition. i'd consider two variants (from HTML):
- maxlength (input field length)
- maxsize (input display length)
 dropping "max" is proly ok, tho, right?

i don't understand the use of "customData or customFields (suitableKey) :{}" in your examnple. can you elaborate?

finally, i'm particularly interested in your mention of a captcha representation. there is nothing like that in cj or cj extensions right now.


--

Lakshmanan Subbiah

unread,
Feb 1, 2017, 11:49:47 PM2/1/17
to Collection+JSON
yeah,
  those two links completely cover the case of read-only, regex and mandatory but IMO these fields may be specific to the form and the use case so only I thought of introducing a new JSONObject within the data Array as customData specific to that form. and It will be easy to make the forms easily adaptable by the client for the specific use case and
please let me know your thoughts on providing the form specific validations from the server.

Thanks & Regards
Lakshmanan



On Wednesday, 1 February 2017 22:05:23 UTC+5:30, Lakshmanan Subbiah wrote:

mca

unread,
Feb 1, 2017, 11:58:03 PM2/1/17
to collect...@googlegroups.com
"providing the form specific validations from the server."

sorry, i don't understand this statement.

--

Lakshmanan Subbiah

unread,
Feb 2, 2017, 12:34:03 AM2/2/17
to Collection+JSON
Consider there are two select fields and selecting one value from a field I have to select only two value out of 5 in the other. eg:
consider two select fields category and subcategory
a category can be  phone, meeting 
and a subcategory can be national, international, online and offline

for this case on selecting phone as a category the possible subcategories should be national or international and on selecting the case as meeting the subcategory can be online or offline.

For a pure hyper client, i think this information should come from server.

Thanks & Regards
Lakshmanan


On Wednesday, 1 February 2017 22:05:23 UTC+5:30, Lakshmanan Subbiah wrote:

mca

unread,
Feb 2, 2017, 12:42:34 AM2/2/17
to collect...@googlegroups.com
are ou describing dependent select fields?

i've drafted (but not yet published) an extension currently called cj-suggest. a (slightly unclear) version of that is documented here: http://rwcbook.github.io/wstl-spec/#_suggest_arrays

i'll be releasing a working draft of this in a few days. happy to discuss this further any time, tho.

finally, i'd still like to hear about this captcha thing you mentioned to me. do we need to start another thread for that?


--

Lakshmanan Subbiah

unread,
Feb 15, 2017, 2:38:35 AM2/15/17
to Collection+JSON
Yeah, I am also interested in discussing the captcha case . We shall discuss in the same thread here itself. In captcha case, we need to provide an image URL as well as digest to the client 
In Collections + JSON how we can solve this ??



Regards
Lakshmanan

On Wednesday, 1 February 2017 22:05:23 UTC+5:30, Lakshmanan Subbiah wrote:

Lakshmanan Subbiah

unread,
Mar 29, 2017, 1:50:28 AM3/29/17
to Collection+JSON
Hi Mike ,
   Shall we discuss about that captcha case we were talking about i am eagerly awaiting to solve the case :)
To unsubscribe from this group and stop receiving emails from it, send an email to collectionjso...@googlegroups.com.

mca

unread,
Mar 29, 2017, 10:45:31 AM3/29/17
to collect...@googlegroups.com
Lakshmanan:

Respectfully, I'm not going to solve your problem for you. 

You have quite a bit of freedom for extending Cj representations at every level of the document. FWIW, my typical approach is to design/implement my own use-case specific solution first. Then, once I know what actually works, I look to see if my use-case can be expended to more generic cases for us by others. 

Finally, whatever you do in Cj is fine as long as you maintain backward compatibility (e.g. don't remove elements, change the use/meaning of an existing element, don't create a new requirement of Cj clients).

If you want to present some possible solutions for feedback here, that's an excellent idea.

To unsubscribe from this group and stop receiving emails from it, send an email to collectionjson+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages