Hyperlink through field

I want to open a hyperlink from a Form. Is it possible to do that through some custom field type (i.e. html or read only field or button or any other field).

Can anyone advise on this?

HTML + read-only should be best. Add your HTML in “options”

I tried that before sending my query. It’s not working. (Link is not
remaining openable).

I was just adding url as shown under. Let me know if I need to add the same
in different way.

Thanking you,

With Regards,
Deven Shah
Safeworld Systems Pvt Ltd
M - 09825060116

Can’t see image. Can you paste what you put in options?

Please find screen shot as requested.

[image: Inline image 1]

Thanking you,

With Regards,
Deven Shah
Safeworld Systems Pvt Ltd
M - 09825060116

Here’s how I got a link to work:

3 Likes

@cpurbaugh Great!! Thank you very much. Heartily appreciated.

Could you please also advise modification in code, if we need to open link in new tab?

This should work:

<a target="_blank" href="http://www.google.com">Google</a>

Example:

Google

Edit: This doesn’t work. I’ll keep looking

1 Like

Thank you very much. We will try this. But, before that we suddenly started getting following message while saving the form after customization (we only changed the text from “Google” to “click_here”. It’s working in Form but showing error while clicking on “update” button of Customize Form. (Sorry, if I am troubling you much, kindly ignore it).

Traceback (innermost last):
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/app.py”, line 67, in application
response = frappe.handler.handle()
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/handler.py”, line 77, in handle
execute_cmd(cmd)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/handler.py”, line 94, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/init.py”, line 781, in call
return fn(*args, **newargs)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/handler.py”, line 29, in runserverobj
frappe.desk.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/desk/form/run_method.py”, line 35, in runserverobj
r = doc.run_method(method)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 551, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 706, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 689, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 545, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/custom/doctype/customize_form/customize_form.py”, line 98, in save_customization
self.update_custom_fields()
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/custom/doctype/customize_form/customize_form.py”, line 164, in update_custom_fields
self.update_in_custom_field(df)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/custom/doctype/customize_form/customize_form.py”, line 194, in update_in_custom_field
custom_field.save()
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 254, in save
self.run_post_save_methods()
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 607, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 551, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 706, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 689, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/document.py”, line 545, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 44, in on_update
updatedb(self.dt)
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/db_schema.py”, line 68, in updatedb
tab.sync()
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/db_schema.py”, line 135, in sync
self.alter()
File “/home/frappe/press/benches/1511191007/apps/frappe/frappe/model/db_schema.py”, line 317, in alter
raise e
OperationalError: (1067, “Invalid default value for ‘prepare_offer’”)

Try making the custom field html type, and just name it “click here” without the underscore. Enter the html for the address in the options box.

@umair or @cpurbaugh

We have removed the custom field on which we were making correction as above (but since this error as per previous post comes while clicking on update button, it does not allow to save the changes). and the same is preventing us from saving new opportunity.

Kindly advise on priority.

@umair I think total number of characters are increased in read only field. So, it’s neither allowing to save customize form (after editing) nor it’s saving opportunity due to error of increase in number of characters from 140. It has fallen into a loop.

How to resolve this. Can you please do something from back-end?

well, what about the ‘prepare_offer’ field? what is that?

hello @cpurbaugh,
Can you please help me with how can i open a modal box on that click…

Please its urgent

Regards

you can set type attach to your field and put your link