In a form (Editable Grid View) a field should be displayed as link and editable as text. How does it work? sc_link is not working (in a form).
If that is not possible, how can I add a normal link? (<a href="http://β¦>My Link</a>)
In a form (Editable Grid View) a field should be displayed as link and editable as text. How does it work? sc_link is not working (in a form).
If that is not possible, how can I add a normal link? (<a href="http://β¦>My Link</a>)
Hi,
i hope this might point you in the right direction.
In the onLoadRecord event something like this:
if(!empty({field}))
{
{field} = β<a href= http://www.β.{field}.">".{field}."</a>";
}
In addition to it you could use an onFocus Ajax event to clear the field when the user clicks into it.
jsb
Thanks, but unfortunately not β¦
If i use a normal grid (= view only), i can use sc_link (<myfield>, βhttp://www.domain.com/invoice/2013/2013-10999.pdfβ, , β2013-10999β, β_blankβ) in event onRecord. When i click on that link, the linked .pdf opens.
How can I have a similar behavior in a form and edit the field as a normal text (only this part: β2013-10999β)? With your solution the field contains the full link, but this is not desired.
You are right, and you only could fiddle around with an onClick Ajax event to clear the field and show the right value. But that would probably be too much confusion for the end user. It would be much easier if we could catch the status change of the line. (just a dream)
On a second thought, what about mimic the behavior of a URL field? It is not exactly what you want but may come close.
Mark your field as a hidden field.
Create a custom text field in your form. Mark βUse lookup to display the field description.β
Create a SQL command:
SELECT IF(doc_name > ββ,CONCAT("<a href= http://www.wherever/it/may/be/",doc_name,">",doc_name,"</a>"),ββ)
FROM document
WHERE doc_id = {doc_id}
In the onValidate event copy the value to your hidden field and clear your input field.
The downside is you get an empty input field when you change to edit mode. But you can spice it up with a watermark and Ajax.
Not necessarily elegant but could do the job.
jsb
Edit:
Oh my! Sometimes it makes sense to switch on the brain.
How about an printer icon? Then you can forget all that additional stuff.
Just use the lookup feature with a SQL command like:
SELECT IF(doc_name > ββ,CONCAT("<a href= βhttp://www.wherever/it/may/be/",doc_name,".pdfβ target =β_blankβ<img_src=βpath/to/your/imageβ/></a>"),ββ)
FROM document
WHERE doc_id = {doc_id}
I just do not get why SC cannot make any field on a form linkable to any application.