Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Delete Image

Quote Reply
Delete Image
Hi,

I have three DBMan SQL 2.0.3 questions, number 1/ is new and the subject of this post and number 2/ & 3/ are questions I have asked before but not received any answers.

I would appreciate it if someone could try to answer my three questions.

1/ What is the field that I need to add to my modify_form.html to enable an existing image to be deleted? On the Sample modify record page there is a checkbox field that deletes the image but I can't view the html source as it is all generated by the script.

2/ I have the following sub in a global -

sub {
my $tags = shift;
my ($field_name) = $DB->table('table_name')->select({'Username' => $tags->{Username} }, ['field_name'])->fetchrow_array();
return $field_name;
}


Now I want to assign the result to a new global tag (e.g <%new_name%> = $field_name) that will be available after the subroutine is executed. What do I need to add to my subroutine to make this work???

3/ In the Sample database that is installed during setup I can't find where the error message "Column price cannot be left blank." comes from. I assumed that all the user messages can be changed in the User Language template but I can't find that particular message. Where can I find it if I want to change it and are there other user messages not in the User Language template?


Thank you.

Simon.

Quote Reply
Re: [jai] Delete Image In reply to
For question2, try changing:

sub {
my $tags = shift;
my ($field_name) = $DB->table('table_name')->select({'Username' => $tags->{Username} }, ['field_name'])->fetchrow_array();
return $field_name;
}

to

sub {
my $tags = shift;
$tags->{new_tag} = $field_name = $DB->table('table_name')->select({'Username' => $tags->{Username} }, ['field_name'])->fetchrow_array;
return $tags;
}
Quote Reply
Re: [jai] Delete Image In reply to
Hi,

In Reply To:
1/ What is the field that I need to add to my modify_form.html to enable an existing image to be deleted

You should add html scripts below into modify_form.html:
<%if ImageFieldName%>
<input type=checkbox name="ImageFieldName_del" value="delete">
<%endif%>

In Reply To:
3/ In the Sample database that is installed during setup I can't find where the error message "Column price cannot be left blank."

You won't be able to change some messages which come from the GT library.

TheStone.


B.
Quote Reply
Re: [TheStone] Delete Image In reply to
Thanks for the Delete Image code, It worked fine!

In relation to the error message "Column price cannot be left blank."

and your reply -

"You won't be able to change some messages which come from the GT library."

I would have thought that to make DBMan SQL 2.0.3 fully internationalized it would be essential to be able to change ALL error messages. The particular message that I was refering to is a common message received when required fields are not completed. I would be very surprised (and dissapointed) if this message cannot be changed. Can you tell me which messages that cannot be changed?

Thank you.

Simon.
Quote Reply
Re: [Paul] Delete Image In reply to
Hi Paul,

Thanks for your help.

I got an error when I tried your sub. My perl isn't the best but something doesn't look right with the = $field_name = ?????

sub {
my $tags = shift;
$tags->{new_tag} = $field_name = $DB->table('table_name')->select({'Username' => $tags->{Username} }, ['field_name'])->fetchrow_array;
return $tags;
}



Any ideas?

Thanks.

Simon.
Quote Reply
Re: [jai] Delete Image In reply to
Yikes I didn't spot that. Try:

Code:
sub {
my $tags = shift;
$tags->{new_tag} = $DB->table('table_name')->select({'Username' => $tags->{Username} }, ['field_name'])->fetchrow_array;
return $tags;
}
Quote Reply
Re: [jai] Delete Image In reply to
Hi,

Just want to let you know that you'll be able to change messages which come from GT library on our next release due.

Cheers,

TheStone.

B.
Quote Reply
Re: [TheStone] Delete Image In reply to
Whatīs the library file that this codes came from?

I can change it manually canīt I?
Quote Reply
Re: [assombracao] Delete Image In reply to
Hi,

You should change subroutines bellow within Home.pm:

sub add_record {
......
# Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = $self->_language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = $self->_language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOTNULL} = $self->_language('ADD_NOTNULL');

if (defined (my $ret = $self->{db}->add ($self->{cgi}))) {
.....
}

sub modify_record {
......
# Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = $self->_language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = $self->_language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOTNULL} = $self->_language('ADD_NOTNULL');

if ($self->{db}->modify ($self->{cgi})) {
.....
}

Also, add two elements into language.txt file.

'ADD_NOTNULL' => 'Column %s cannot be left blank.',
'ADD_UNIQUE' => 'The column \'%s\' must be unique, and already has an entry \'%s\'.',

That should work.

TheStone.

B.
Quote Reply
Re: [TheStone] Delete Image In reply to
Hi,

Whens the next release due?????

Thanks.

Simon.