NetTalk Central

Author Topic: cell with text and button  (Read 5311 times)

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
cell with text and button
« on: November 22, 2012, 02:24:56 AM »
Hallo,


How can I have in a cell a text and a button? Also after a condition the button will hide and will remain only the text ...
Is this possible? I play with rowspan and colspan but never got it working...

I need the button from template because will open an popup window... in hand code I could make everything on that cell but cannot make it with button from template.

Any tips I appreciate!

Thank you,
Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: cell with text and button
« Reply #1 on: November 22, 2012, 04:51:03 AM »
why do you need the text and the button in the same cell?

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: cell with text and button
« Reply #2 on: November 22, 2012, 12:24:03 PM »
Hallo Bruce,

In that cell I have a button for confirmation. After they confirm the button must be hide and I have to show a text with an image.
How can I do this? With text I know how to do...but with a button don't know if it's possible...
I can put the button on the right column just that this way will take a lot of space... and by design it's ugly and not user friendly.... The best is to implement the text and button on the same cell.

I really appreciate any tips ...

Thank you,
Robert


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: cell with text and button
« Reply #3 on: November 22, 2012, 10:17:57 PM »
Hi Robert,

it's do-able, but it'll take a little bit of hand code.

Basically what you want to do is add code to the value::fieldname routine.
This is where the html for the cell is generated.

From what you have described I think it would be easy to place a condition in there that "wraps" the generated code, replacing the button with some text if the condition is met.

Obviously you would set the condition in the validate::fieldname routine, (as a sessionvalue of course) and then set the button to "refresh itself" when pressed.

cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: cell with text and button
« Reply #4 on: November 23, 2012, 04:50:23 AM »
Thank you Bruce!
I think the problem it's solved.

I omit the original generated code and then put some condition ...

This is the generated code for button:


  ! End of "Before a Cell value is calculated"
    if false
    else ! default settings for column
      loc:extra = ''
      packet = clip(packet) & p_web.DivHeader('B_Transferuri_btn_Cerere_'&TRA:GUID,,net:crc,,loc:extra)
      loc:disabled = ''
      packet = clip(packet) & p_web.CreateButton('button','btn_Cerere','Retrimite cerere',p_web.combine(Choose('Retrimite cerere' <> '',p_web.site.style.BrowseOtherButtonWithText,p_web.site.style.BrowseOtherButtonWithOutText),l:CssButton),loc:formname,,,,loc:javascript,loc:disabled,,,,,,0,,,,'nt-left',1,,'Retrimite cerere','bserver')!g
    End
    packet = clip(packet) & p_web.DivFooter(Net:NoSend)
    ! Start of "After a Cell value is calculated"
    ! [Priority 5000]


now if I don't need the button and put only text it's correct like this?


  ! End of "Before a Cell value is calculated"
    if false
    else ! default settings for column
      loc:extra = ''
      packet = clip(packet) & p_web.DivHeader('B_Transferuri_btn_Cerere_'&TRA:GUID,,net:crc,,loc:extra)
      loc:disabled = ''
      packet = clip(packet) &  '<p>Data: '&format(TRA:DataCerere,@D8-)&'<br /><span style="color:green;">Trimisa cu succes!</span></p>'
    End
    packet = clip(packet) & p_web.DivFooter(Net:NoSend)
    ! Start of "After a Cell value is calculated"
    ! [Priority 5000]


or I could just put


  ! End of "Before a Cell value is calculated"
    if false
    else ! default settings for column
      packet = clip(packet) &  '<p>Data: '&format(TRA:DataCerere,@D8-)&'<br /><span style="color:green;">Trimisa cu succes!</span></p>'
    End
    ! Start of "After a Cell value is calculated"
    ! [Priority 5000]

The questions is: Do I need the header and footer packet?

Thank you again.
Robert

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: cell with text and button
« Reply #5 on: November 23, 2012, 08:26:53 AM »
I'm sorry Robert - my last post was bad advice. There's an easier way.
(so you can delete the hand-code - sorry...)

the solution is to go to the browse column, and you'll see a tab there "Conditional".
you can enter a condition there, and if true it'll show the text in "Display" not the button.

I missed it 'cause I was looking at the tabs for the _button settings_ but you must look up higher, to the top tab, where it says "conditional".

cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: cell with text and button
« Reply #6 on: November 26, 2012, 02:45:21 AM »
Thank you Bruce, I try with display and works ok but this way I have a problem. With display condition I could not have both text and button. I need also text and button not only text or only button.,,... so this way I think the first approach will be the best...or there must be something else? :o)

*When I implement now by design they want both text and button and after confirmation only text.

Thanks again for help,
Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: cell with text and button
« Reply #7 on: November 26, 2012, 11:11:10 PM »
yes, if you want text _and_ a button then the first way is best.
Of course you could put the text _on_ the button.

cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: cell with text and button
« Reply #8 on: November 26, 2012, 11:44:46 PM »
Noted, and thank you,
Regarding my question bellow on how to use button source code what do you say?
Thank you,
Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: cell with text and button
« Reply #9 on: November 27, 2012, 09:16:51 PM »
>> Do I need the header and footer packet?

yes. Absolutely.

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: cell with text and button
« Reply #10 on: November 27, 2012, 11:42:50 PM »
Thank you Bruce,
Works perfect!
Robert