Hi,

Well, these are my initial thoughts: the warning to the user would probably
be done through a Javascript validation function, just like the ones in
place now for checking for mandatory fields. That function, in turn, would
have to call PHP code that determined whether that value was unique. The way
to get Javascript to communicate with PHP is via an API service, just like
autocompletion uses. So, in short, it seems to me that you'd need to create:

- a new API class, just like SF_AutocompleteAPI.php, that takes in a
property name and value and determines if it's been used already
- a new Javascript function that calls that API function, using Ajax, and
returns a value of 'true' or 'false' (unfortunately, there's nothing in the
current SF code that quite matches this functionality)
- handling for a new parameter for fields in form definitions that defines a
field as "unique"
- adding a call to that Javascript function to the validate_all() function,
for every "unique" field

...and I think that's it. :)

-Yaron

On Thu, Mar 19, 2009 at 3:39 PM, <[email protected]> wrote:

>
> Hi,
> I write to the group a few weeks ago and my concern was this:
>
> "In the scope of my master thesis I want to develop an additional
> fonctionality to semantic form with the purpose the identification in
> a form of a already available attributvalue.
> I  explain, for example I have in my wiki the property "link" for a
> form"webservice" and I want to warn a user if he tries to put a same
> link-value that has already been saved/used.
> My reflection is, before a user saves the formular, there should be a
> previous step, which is the controll in the database whether the
> attributs the user entered already exist in the database or not.If
> the
> given value already exists in the database, the user should receive a
> warning and the form will not be saved."
>
> I receive from Yaron the tip to read the semantic forms code and I did
> it.
> I know for example now that the programm I want to write deals with
> the Code of SF_AddData.php because this code is responsible for the
> displaying of the pre-defined form for adding data, in that I should
> work.
> Now, I don't really know how to begin the whole thing.
> Should I write another Special programm which I should put in the
> Specials folder? should I just put some functions in SF_AddData.php?
> Should I whrite a programm which I should include with the include
> function in SF_AddData.php and put the programm in the includes folder
> of semantic form?
> Please give some advices how I can do that, it is very important for
> me.
> I would really appreciate if you could answer me a give me some
> advices.
>
> Thank you in advance,
>
> ErnstJo
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Semantic Forms" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/semantic-forms?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to